Skip to content

Commit bbad387

Browse files
committed
fixed CS
1 parent f39ed57 commit bbad387

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

src/Symfony/Bridge/Twig/Extension/StopwatchExtension.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
class StopwatchExtension extends \Twig_Extension
2323
{
2424
private $stopwatch;
25-
25+
2626
public function __construct(Stopwatch $stopwatch = null)
2727
{
2828
$this->stopwatch = $stopwatch;
2929
}
30-
30+
3131
public function getTokenParsers()
3232
{
3333
return array(
@@ -39,19 +39,19 @@ public function getTokenParsers()
3939
new StopwatchTokenParser($this->stopwatch !== null),
4040
);
4141
}
42-
42+
4343
public function getName()
4444
{
4545
return 'stopwatch';
4646
}
47-
47+
4848
public function startEvent($name)
4949
{
5050
if ($this->stopwatch instanceof Stopwatch) {
5151
$this->stopwatch->start($name, 'template');
5252
}
5353
}
54-
54+
5555
public function stopEvent($name)
5656
{
5757
if ($this->stopwatch instanceof Stopwatch) {

src/Symfony/Bridge/Twig/Node/StopwatchNode.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ public function __construct($name, $body, $lineno = 0, $tag = null)
2222
{
2323
parent::__construct(array('body' => $body), array('name' => $name), $lineno, $tag);
2424
}
25-
25+
2626
public function compile(\Twig_Compiler $compiler)
2727
{
2828
$name = $this->getAttribute('name');
29-
29+
3030
$compiler
3131
->write('$this->env->getExtension(\'stopwatch\')->startEvent(\''.$name.'\');')
3232
->subcompile($this->getNode('body'))

src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ public function getTimingTemplates()
6262
return array(
6363
array('{% stopwatch foo %}something{% endstopwatch %}', 'foo'),
6464
array('{% stopwatch foo %}symfony2 is fun{% endstopwatch %}{% stopwatch bar %}something{% endstopwatch %}', array('foo', 'bar')),
65-
6665
array('{% stopwatch foo %}something{% endstopwatch foo %}', 'foo'),
67-
68-
array("{% stopwatch 'foo.bar' %}something{% endstopwatch %}", 'foo.bar'),
66+
array('{% stopwatch "foo.bar" %}something{% endstopwatch %}', 'foo.bar'),
6967
);
7068
}
7169

src/Symfony/Bridge/Twig/TokenParser/StopwatchTokenParser.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function parse(\Twig_Token $token)
3232
{
3333
$lineno = $token->getLine();
3434
$stream = $this->parser->getStream();
35-
35+
3636
// {% stopwatch bar %}
3737
if ($stream->test(\Twig_Token::NAME_TYPE)) {
3838
$name = $stream->expect(\Twig_Token::NAME_TYPE)->getValue();
@@ -41,35 +41,35 @@ public function parse(\Twig_Token $token)
4141
}
4242

4343
if (in_array($name, $this->_events)) {
44-
throw new \Twig_Error_Syntax(sprintf("The stopwatch event '%s' has already been defined", $name));
44+
throw new \Twig_Error_Syntax(sprintf('The stopwatch event "%s" has already been defined.', $name));
4545
}
4646
$this->_events[] = $name;
4747

4848
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
49-
49+
5050
// {% endstopwatch %} or {% endstopwatch bar %}
5151
$body = $this->parser->subparse(array($this, 'decideStopwatchEnd'), true);
5252
if ($stream->test(\Twig_Token::NAME_TYPE) || $stream->test(\Twig_Token::STRING_TYPE)) {
5353
$value = $stream->next()->getValue();
5454

5555
if ($name != $value) {
56-
throw new \Twig_Error_Syntax(sprintf("Expected endstopwatch for event '%s' (but %s given)", $name, $value));
56+
throw new \Twig_Error_Syntax(sprintf('Expected endstopwatch for event "%s" (but "%s" given).', $name, $value));
5757
}
5858
}
5959
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
60-
60+
6161
if ($this->stopwatchIsAvailable) {
6262
return new StopwatchNode($name, $body, $lineno, $this->getTag());
6363
}
6464

6565
return $body;
6666
}
67-
67+
6868
public function decideStopwatchEnd(\Twig_Token $token)
6969
{
7070
return $token->test('endstopwatch');
7171
}
72-
72+
7373
public function getTag()
7474
{
7575
return 'stopwatch';

0 commit comments

Comments
 (0)