mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 11:56:50 +00:00
improve readability
This commit is contained in:
+9
-8
@@ -330,14 +330,15 @@ Now, let's see the actual code of this class::
|
||||
{
|
||||
public function parse(Twig_Token $token)
|
||||
{
|
||||
$lineno = $token->getLine();
|
||||
$name = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue();
|
||||
$this->parser->getStream()->expect(Twig_Token::OPERATOR_TYPE, '=');
|
||||
$value = $this->parser->getExpressionParser()->parseExpression();
|
||||
$parser = $this->parser;
|
||||
$stream = $parser->getStream();
|
||||
|
||||
$this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
|
||||
$name = $stream->expect(Twig_Token::NAME_TYPE)->getValue();
|
||||
$stream->expect(Twig_Token::OPERATOR_TYPE, '=');
|
||||
$value = $parser->getExpressionParser()->parseExpression();
|
||||
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
||||
|
||||
return new Project_Set_Node($name, $value, $lineno, $this->getTag());
|
||||
return new Project_Set_Node($name, $value, $token->getLine(), $this->getTag());
|
||||
}
|
||||
|
||||
public function getTag()
|
||||
@@ -384,9 +385,9 @@ The ``Project_Set_Node`` class itself is rather simple::
|
||||
|
||||
class Project_Set_Node extends Twig_Node
|
||||
{
|
||||
public function __construct($name, Twig_Node_Expression $value, $lineno, $tag = null)
|
||||
public function __construct($name, Twig_Node_Expression $value, $lineNo, $tag = null)
|
||||
{
|
||||
parent::__construct(array('value' => $value), array('name' => $name), $lineno, $tag);
|
||||
parent::__construct(array('value' => $value), array('name' => $name), $lineNo, $tag);
|
||||
}
|
||||
|
||||
public function compile(Twig_Compiler $compiler)
|
||||
|
||||
Reference in New Issue
Block a user