aboutsummaryrefslogtreecommitdiffstats
path: root/public/system/library/template/Twig/Node/Expression/Binary/EndsWith.php
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2019-08-18 21:14:58 -0500
committerJesús <heckyel@hyperbola.info>2019-08-18 21:14:58 -0500
commit2eed7b082f83630301e51f57ca8394de228a8605 (patch)
tree1d19962d22d30f99317d9276e4bae7744fc93fc2 /public/system/library/template/Twig/Node/Expression/Binary/EndsWith.php
downloadlibrecart-2eed7b082f83630301e51f57ca8394de228a8605.tar.lz
librecart-2eed7b082f83630301e51f57ca8394de228a8605.tar.xz
librecart-2eed7b082f83630301e51f57ca8394de228a8605.zip
first commit
Diffstat (limited to 'public/system/library/template/Twig/Node/Expression/Binary/EndsWith.php')
-rw-r--r--public/system/library/template/Twig/Node/Expression/Binary/EndsWith.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/public/system/library/template/Twig/Node/Expression/Binary/EndsWith.php b/public/system/library/template/Twig/Node/Expression/Binary/EndsWith.php
new file mode 100644
index 0000000..93b3b96
--- /dev/null
+++ b/public/system/library/template/Twig/Node/Expression/Binary/EndsWith.php
@@ -0,0 +1,30 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) 2013 Fabien Potencier
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class Twig_Node_Expression_Binary_EndsWith extends Twig_Node_Expression_Binary
+{
+ public function compile(Twig_Compiler $compiler)
+ {
+ $left = $compiler->getVarName();
+ $right = $compiler->getVarName();
+ $compiler
+ ->raw(sprintf('(is_string($%s = ', $left))
+ ->subcompile($this->getNode('left'))
+ ->raw(sprintf(') && is_string($%s = ', $right))
+ ->subcompile($this->getNode('right'))
+ ->raw(sprintf(') && (\'\' === $%2$s || $%2$s === substr($%1$s, -strlen($%2$s))))', $left, $right))
+ ;
+ }
+
+ public function operator(Twig_Compiler $compiler)
+ {
+ return $compiler->raw('');
+ }
+}