src/TwigJs/Compiler/Expression/Binary/AndCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class AndCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_And'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_And) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_And, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('&&'); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Binary/BitwiseAndCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class BitwiseAndCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_BitwiseAnd'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_BitwiseAnd) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_BitwiseAnd, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('&'); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Binary/BitwiseOrCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class BitwiseOrCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_BitwiseOr'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_BitwiseOr) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_BitwiseOr, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('|'); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Binary/BitwiseXorCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class BitwiseXorCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_BitwiseXor'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_BitwiseXor) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_BitwiseXor, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('^'); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Binary/ConcatCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class ConcatCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_Concat'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_Concat) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_Concat, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('+'); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Binary/DivCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class DivCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_Div'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_Div) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_Div, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('/'); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Binary/EqualCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class EqualCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_Equal'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_Equal) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_Equal, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('=='); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Binary/GreaterCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class GreaterCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_Greater'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_Greater) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_Greater, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('>'); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Binary/GreaterEqualCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class GreaterEqualCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_GreaterEqual'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_GreaterEqual) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_GreaterEqual, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('>='); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Binary/LessCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class LessCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_Less'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_Less) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_Less, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('<'); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Binary/LessEqualCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class LessEqualCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_LessEqual'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_LessEqual) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_LessEqual, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('<='); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Binary/ModCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class ModCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_Mod'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_Mod) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_Mod, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('%'); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Binary/MulCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class MulCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_Mul'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_Mul) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_Mul, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('*'); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Binary/NotEqualCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class NotEqualCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_NotEqual'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_NotEqual) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_NotEqual, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('!='); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Binary/OrCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class OrCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_Or'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_Or) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_Or, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('||'); |
43 |
|
} |
44 |
|
} |
45 |
|
|
src/TwigJs/Compiler/Expression/Binary/SubCompiler.php 1 location
|
@@ 24-44 (lines=21) @@
|
21 |
|
use TwigJs\Compiler\Expression\BinaryCompiler; |
22 |
|
use TwigJs\JsCompiler; |
23 |
|
|
24 |
|
class SubCompiler extends BinaryCompiler |
25 |
|
{ |
26 |
|
public function getType() |
27 |
|
{ |
28 |
|
return 'Twig_Node_Expression_Binary_Sub'; |
29 |
|
} |
30 |
|
|
31 |
|
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node) |
32 |
|
{ |
33 |
|
if (!$node instanceof \Twig_Node_Expression_Binary_Sub) { |
34 |
|
throw new \RuntimeException( |
35 |
|
sprintf( |
36 |
|
'$node must be an instanceof of \Twig_Node_Expression_Binary_Sub, but got "%s".', |
37 |
|
get_class($node) |
38 |
|
) |
39 |
|
); |
40 |
|
} |
41 |
|
|
42 |
|
return $compiler->raw('-'); |
43 |
|
} |
44 |
|
} |
45 |
|
|