protected $finalValidationClosures = array();
protected $allowOverwrite = true;
protected $required = false;
+ protected $deprecationMessage = null;
protected $equivalentValues = array();
protected $attributes = array();
/**
- * Constructor.
+ * @param string|null $name The name of the node
+ * @param NodeInterface|null $parent The parent of this node
*
- * @param string $name The name of the node
- * @param NodeInterface $parent The parent of this node
- *
- * @throws \InvalidArgumentException if the name contains a period.
+ * @throws \InvalidArgumentException if the name contains a period
*/
public function __construct($name, NodeInterface $parent = null)
{
- if (false !== strpos($name, '.')) {
+ if (false !== strpos($name = (string) $name, '.')) {
throw new \InvalidArgumentException('The name must not contain ".".');
}
$this->required = (bool) $boolean;
}
+ /**
+ * Sets this node as deprecated.
+ *
+ * You can use %node% and %path% placeholders in your message to display,
+ * respectively, the node name and its complete path.
+ *
+ * @param string|null $message Deprecated message
+ */
+ public function setDeprecated($message)
+ {
+ $this->deprecationMessage = $message;
+ }
+
/**
* Sets if this node can be overridden.
*
}
/**
- * Checks if this node is required.
- *
- * @return bool
+ * {@inheritdoc}
*/
public function isRequired()
{
}
/**
- * Returns the name of this node.
+ * Checks if this node is deprecated.
*
- * @return string The Node's name
+ * @return bool
+ */
+ public function isDeprecated()
+ {
+ return null !== $this->deprecationMessage;
+ }
+
+ /**
+ * Returns the deprecated message.
+ *
+ * @param string $node the configuration node name
+ * @param string $path the path of the node
+ *
+ * @return string
+ */
+ public function getDeprecationMessage($node, $path)
+ {
+ return strtr($this->deprecationMessage, array('%node%' => $node, '%path%' => $path));
+ }
+
+ /**
+ * {@inheritdoc}
*/
public function getName()
{
}
/**
- * Retrieves the path of this node.
- *
- * @return string The Node's path
+ * {@inheritdoc}
*/
public function getPath()
{
}
/**
- * Merges two values together.
- *
- * @param mixed $leftSide
- * @param mixed $rightSide
- *
- * @return mixed The merged value
- *
- * @throws ForbiddenOverwriteException
+ * {@inheritdoc}
*/
final public function merge($leftSide, $rightSide)
{
}
/**
- * Normalizes a value, applying all normalization closures.
- *
- * @param mixed $value Value to normalize
- *
- * @return mixed The normalized value
+ * {@inheritdoc}
*/
final public function normalize($value)
{
}
/**
- * Finalizes a value, applying all finalization closures.
- *
- * @param mixed $value The value to finalize
- *
- * @return mixed The finalized value
- *
- * @throws Exception
- * @throws InvalidConfigurationException
+ * {@inheritdoc}
*/
final public function finalize($value)
{