@@ -29,6 +29,7 @@ abstract class BaseNode implements NodeInterface
2929 protected $ finalValidationClosures = array ();
3030 protected $ allowOverwrite = true ;
3131 protected $ required = false ;
32+ protected $ deprecationMessage = null ;
3233 protected $ equivalentValues = array ();
3334 protected $ attributes = array ();
3435
@@ -141,6 +142,19 @@ public function setRequired($boolean)
141142 $ this ->required = (bool ) $ boolean ;
142143 }
143144
145+ /**
146+ * Sets this node as deprecated.
147+ *
148+ * You can use %node% and %path% placeholders in your message to display,
149+ * respectively, the node name and its complete path.
150+ *
151+ * @param string|null $message Deprecated message
152+ */
153+ public function setDeprecated ($ message )
154+ {
155+ $ this ->deprecationMessage = $ message ;
156+ }
157+
144158 /**
145159 * Sets if this node can be overridden.
146160 *
@@ -181,6 +195,29 @@ public function isRequired()
181195 return $ this ->required ;
182196 }
183197
198+ /**
199+ * Checks if this node is deprecated.
200+ *
201+ * @return bool
202+ */
203+ public function isDeprecated ()
204+ {
205+ return null !== $ this ->deprecationMessage ;
206+ }
207+
208+ /**
209+ * Returns the deprecated message.
210+ *
211+ * @param string $node the configuration node name
212+ * @param string $path the path of the node
213+ *
214+ * @return string
215+ */
216+ public function getDeprecationMessage ($ node , $ path )
217+ {
218+ return strtr ($ this ->deprecationMessage , array ('%node% ' => $ node , '%path% ' => $ path ));
219+ }
220+
184221 /**
185222 * Returns the name of this node.
186223 *
0 commit comments