X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fconfig%2FDefinition%2FBaseNode.php;h=9057f1478a192e97f4ee4cc9f16dd90e4322c342;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=dbf36335b69e38ff46b0ebb242ccc06d0f004272;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/symfony/config/Definition/BaseNode.php b/vendor/symfony/config/Definition/BaseNode.php index dbf36335b..9057f1478 100644 --- a/vendor/symfony/config/Definition/BaseNode.php +++ b/vendor/symfony/config/Definition/BaseNode.php @@ -29,20 +29,19 @@ abstract class BaseNode implements NodeInterface 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 ".".'); } @@ -141,6 +140,19 @@ abstract class BaseNode implements NodeInterface $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. * @@ -172,9 +184,7 @@ abstract class BaseNode implements NodeInterface } /** - * Checks if this node is required. - * - * @return bool + * {@inheritdoc} */ public function isRequired() { @@ -182,9 +192,30 @@ abstract class BaseNode implements NodeInterface } /** - * 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() { @@ -192,9 +223,7 @@ abstract class BaseNode implements NodeInterface } /** - * Retrieves the path of this node. - * - * @return string The Node's path + * {@inheritdoc} */ public function getPath() { @@ -208,24 +237,12 @@ abstract class BaseNode implements NodeInterface } /** - * Merges two values together. - * - * @param mixed $leftSide - * @param mixed $rightSide - * - * @return mixed The merged value - * - * @throws ForbiddenOverwriteException + * {@inheritdoc} */ final public function merge($leftSide, $rightSide) { if (!$this->allowOverwrite) { - throw new ForbiddenOverwriteException(sprintf( - 'Configuration path "%s" cannot be overwritten. You have to ' - .'define all options for this path, and any of its sub-paths in ' - .'one configuration section.', - $this->getPath() - )); + throw new ForbiddenOverwriteException(sprintf('Configuration path "%s" cannot be overwritten. You have to define all options for this path, and any of its sub-paths in one configuration section.', $this->getPath())); } $this->validateType($leftSide); @@ -235,11 +252,7 @@ abstract class BaseNode implements NodeInterface } /** - * Normalizes a value, applying all normalization closures. - * - * @param mixed $value Value to normalize - * - * @return mixed The normalized value + * {@inheritdoc} */ final public function normalize($value) { @@ -287,14 +300,7 @@ abstract class BaseNode implements NodeInterface } /** - * 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) {