| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
* This file is part of Twig. |
| 5 |
* |
| 6 |
* (c) Fabien Potencier |
| 7 |
* |
| 8 |
* For the full copyright and license information, please view the LICENSE |
| 9 |
* file that was distributed with this source code. |
| 10 |
*/ |
| 11 |
namespace ElementorDeps\Twig\Node\Expression\Test; |
| 12 |
|
| 13 |
use ElementorDeps\Twig\Compiler; |
| 14 |
use ElementorDeps\Twig\Node\Expression\TestExpression; |
| 15 |
/** |
| 16 |
* Checks if a variable is divisible by a number. |
| 17 |
* |
| 18 |
* {% if loop.index is divisible by(3) %} |
| 19 |
* |
| 20 |
* @author Fabien Potencier <fabien@symfony.com> |
| 21 |
*/ |
| 22 |
class DivisiblebyTest extends TestExpression |
| 23 |
{ |
| 24 |
public function compile(Compiler $compiler) : void |
| 25 |
{ |
| 26 |
$compiler->raw('(0 == ')->subcompile($this->getNode('node'))->raw(' % ')->subcompile($this->getNode('arguments')->getNode('0'))->raw(')'); |
| 27 |
} |
| 28 |
} |
| 29 |
|