From 3606ad0dcdf3a05d0bf7cc943f7533415bea8d48 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 7 Jun 2010 19:28:03 +0200 Subject: [PATCH] added some phpdoc for TokenParser classes --- lib/Twig/TokenParser/AutoEscape.php | 12 ++++++++++++ lib/Twig/TokenParser/Block.php | 12 ++++++++++++ lib/Twig/TokenParser/Debug.php | 12 ++++++++++++ lib/Twig/TokenParser/Display.php | 12 ++++++++++++ lib/Twig/TokenParser/Extends.php | 12 ++++++++++++ lib/Twig/TokenParser/Filter.php | 12 ++++++++++++ lib/Twig/TokenParser/For.php | 12 ++++++++++++ lib/Twig/TokenParser/If.php | 12 ++++++++++++ lib/Twig/TokenParser/Import.php | 12 ++++++++++++ lib/Twig/TokenParser/Include.php | 12 ++++++++++++ lib/Twig/TokenParser/Macro.php | 12 ++++++++++++ lib/Twig/TokenParser/Parent.php | 12 ++++++++++++ lib/Twig/TokenParser/Sandbox.php | 12 ++++++++++++ lib/Twig/TokenParser/Set.php | 12 ++++++++++++ lib/Twig/TokenParser/Trans.php | 12 ++++++++++++ lib/Twig/TokenParserInterface.php | 12 ++++++++++++ 16 files changed, 192 insertions(+), 0 deletions(-) diff --git a/lib/Twig/TokenParser/AutoEscape.php b/lib/Twig/TokenParser/AutoEscape.php index 01e1b88..08f047b 100644 --- a/lib/Twig/TokenParser/AutoEscape.php +++ b/lib/Twig/TokenParser/AutoEscape.php @@ -10,6 +10,13 @@ */ class Twig_TokenParser_AutoEscape extends Twig_TokenParser { + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); @@ -39,6 +46,11 @@ class Twig_TokenParser_AutoEscape extends Twig_TokenParser return $token->test('endautoescape'); } + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag() { return 'autoescape'; diff --git a/lib/Twig/TokenParser/Block.php b/lib/Twig/TokenParser/Block.php index 2fa61e5..1d2f846 100644 --- a/lib/Twig/TokenParser/Block.php +++ b/lib/Twig/TokenParser/Block.php @@ -11,6 +11,13 @@ */ class Twig_TokenParser_Block extends Twig_TokenParser { + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); @@ -53,6 +60,11 @@ class Twig_TokenParser_Block extends Twig_TokenParser return $token->test('endblock'); } + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag() { return 'block'; diff --git a/lib/Twig/TokenParser/Debug.php b/lib/Twig/TokenParser/Debug.php index 01fc6e2..aba2e9d 100644 --- a/lib/Twig/TokenParser/Debug.php +++ b/lib/Twig/TokenParser/Debug.php @@ -10,6 +10,13 @@ */ class Twig_TokenParser_Debug extends Twig_TokenParser { + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); @@ -23,6 +30,11 @@ class Twig_TokenParser_Debug extends Twig_TokenParser return new Twig_Node_Debug($expr, $lineno, $this->getTag()); } + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag() { return 'debug'; diff --git a/lib/Twig/TokenParser/Display.php b/lib/Twig/TokenParser/Display.php index 2d24eef..58e6ba6 100644 --- a/lib/Twig/TokenParser/Display.php +++ b/lib/Twig/TokenParser/Display.php @@ -10,6 +10,13 @@ */ class Twig_TokenParser_Display extends Twig_TokenParser { + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); @@ -22,6 +29,11 @@ class Twig_TokenParser_Display extends Twig_TokenParser return new Twig_Node_BlockReference($name, $lineno, $this->getTag()); } + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag() { return 'display'; diff --git a/lib/Twig/TokenParser/Extends.php b/lib/Twig/TokenParser/Extends.php index 3e04d1a..037d57a 100644 --- a/lib/Twig/TokenParser/Extends.php +++ b/lib/Twig/TokenParser/Extends.php @@ -11,6 +11,13 @@ */ class Twig_TokenParser_Extends extends Twig_TokenParser { + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token) { if (null !== $this->parser->getParent()) { @@ -22,6 +29,11 @@ class Twig_TokenParser_Extends extends Twig_TokenParser return null; } + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag() { return 'extends'; diff --git a/lib/Twig/TokenParser/Filter.php b/lib/Twig/TokenParser/Filter.php index 31c9387..4d053b7 100644 --- a/lib/Twig/TokenParser/Filter.php +++ b/lib/Twig/TokenParser/Filter.php @@ -10,6 +10,13 @@ */ class Twig_TokenParser_Filter extends Twig_TokenParser { + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token) { $filters = $this->parser->getExpressionParser()->parseFilterExpressionRaw(); @@ -36,6 +43,11 @@ class Twig_TokenParser_Filter extends Twig_TokenParser return $token->test('endfilter'); } + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag() { return 'filter'; diff --git a/lib/Twig/TokenParser/For.php b/lib/Twig/TokenParser/For.php index f18b72f..24afd6b 100644 --- a/lib/Twig/TokenParser/For.php +++ b/lib/Twig/TokenParser/For.php @@ -11,6 +11,13 @@ */ class Twig_TokenParser_For extends Twig_TokenParser { + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); @@ -56,6 +63,11 @@ class Twig_TokenParser_For extends Twig_TokenParser return $token->test('endfor'); } + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag() { return 'for'; diff --git a/lib/Twig/TokenParser/If.php b/lib/Twig/TokenParser/If.php index 14a7429..d4f38b0 100644 --- a/lib/Twig/TokenParser/If.php +++ b/lib/Twig/TokenParser/If.php @@ -11,6 +11,13 @@ */ class Twig_TokenParser_If extends Twig_TokenParser { + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); @@ -65,6 +72,11 @@ class Twig_TokenParser_If extends Twig_TokenParser return $token->test(array('endif')); } + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag() { return 'if'; diff --git a/lib/Twig/TokenParser/Import.php b/lib/Twig/TokenParser/Import.php index 1bc89ce..e791138 100644 --- a/lib/Twig/TokenParser/Import.php +++ b/lib/Twig/TokenParser/Import.php @@ -10,6 +10,13 @@ */ class Twig_TokenParser_Import extends Twig_TokenParser { + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token) { $macro = $this->parser->getExpressionParser()->parseExpression(); @@ -20,6 +27,11 @@ class Twig_TokenParser_Import extends Twig_TokenParser return new Twig_Node_Import($macro, $var, $token->getLine(), $this->getTag()); } + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag() { return 'import'; diff --git a/lib/Twig/TokenParser/Include.php b/lib/Twig/TokenParser/Include.php index bb68eb6..cfdaab7 100644 --- a/lib/Twig/TokenParser/Include.php +++ b/lib/Twig/TokenParser/Include.php @@ -11,6 +11,13 @@ */ class Twig_TokenParser_Include extends Twig_TokenParser { + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token) { $expr = $this->parser->getExpressionParser()->parseExpression(); @@ -27,6 +34,11 @@ class Twig_TokenParser_Include extends Twig_TokenParser return new Twig_Node_Include($expr, $variables, $token->getLine(), $this->getTag()); } + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag() { return 'include'; diff --git a/lib/Twig/TokenParser/Macro.php b/lib/Twig/TokenParser/Macro.php index 567ecfa..20186c6 100644 --- a/lib/Twig/TokenParser/Macro.php +++ b/lib/Twig/TokenParser/Macro.php @@ -10,6 +10,13 @@ */ class Twig_TokenParser_Macro extends Twig_TokenParser { + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); @@ -31,6 +38,11 @@ class Twig_TokenParser_Macro extends Twig_TokenParser return $token->test('endmacro'); } + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag() { return 'macro'; diff --git a/lib/Twig/TokenParser/Parent.php b/lib/Twig/TokenParser/Parent.php index c157cef..7867cb4 100644 --- a/lib/Twig/TokenParser/Parent.php +++ b/lib/Twig/TokenParser/Parent.php @@ -11,6 +11,13 @@ */ class Twig_TokenParser_Parent extends Twig_TokenParser { + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token) { if (!count($this->parser->getBlockStack())) { @@ -21,6 +28,11 @@ class Twig_TokenParser_Parent extends Twig_TokenParser return new Twig_Node_Parent($this->parser->peekBlockStack(), $token->getLine(), $this->getTag()); } + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag() { return 'parent'; diff --git a/lib/Twig/TokenParser/Sandbox.php b/lib/Twig/TokenParser/Sandbox.php index dbca198..a4b6f33 100644 --- a/lib/Twig/TokenParser/Sandbox.php +++ b/lib/Twig/TokenParser/Sandbox.php @@ -10,6 +10,13 @@ */ class Twig_TokenParser_Sandbox extends Twig_TokenParser { + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token) { $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); @@ -24,6 +31,11 @@ class Twig_TokenParser_Sandbox extends Twig_TokenParser return $token->test('endsandbox'); } + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag() { return 'sandbox'; diff --git a/lib/Twig/TokenParser/Set.php b/lib/Twig/TokenParser/Set.php index 72fb028..05a565d 100644 --- a/lib/Twig/TokenParser/Set.php +++ b/lib/Twig/TokenParser/Set.php @@ -10,6 +10,13 @@ */ class Twig_TokenParser_Set extends Twig_TokenParser { + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); @@ -47,6 +54,11 @@ class Twig_TokenParser_Set extends Twig_TokenParser return $token->test('endset'); } + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag() { return 'set'; diff --git a/lib/Twig/TokenParser/Trans.php b/lib/Twig/TokenParser/Trans.php index 7aa49f4..806bf3d 100644 --- a/lib/Twig/TokenParser/Trans.php +++ b/lib/Twig/TokenParser/Trans.php @@ -10,6 +10,13 @@ */ class Twig_TokenParser_Trans extends Twig_TokenParser { + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token) { $lineno = $token->getLine(); @@ -45,6 +52,11 @@ class Twig_TokenParser_Trans extends Twig_TokenParser return $token->test('endtrans'); } + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag() { return 'trans'; diff --git a/lib/Twig/TokenParserInterface.php b/lib/Twig/TokenParserInterface.php index 77407e9..8bcc691 100644 --- a/lib/Twig/TokenParserInterface.php +++ b/lib/Twig/TokenParserInterface.php @@ -12,7 +12,19 @@ interface Twig_TokenParserInterface { public function setParser(Twig_Parser $parser); + /** + * Parses a token and returns a node. + * + * @param Twig_Token $token A Twig_Token instance + * + * @return Twig_NodeInterface A Twig_NodeInterface instance + */ public function parse(Twig_Token $token); + /** + * Gets the tag name associated with this token parser. + * + * @param string The tag name + */ public function getTag(); } -- 1.7.2.5