You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
665 B
33 lines
665 B
<?php
|
|
// src/Twig/AppExtension.php
|
|
namespace App\TwigTests;
|
|
|
|
use Twig\Extension\AbstractExtension;
|
|
use Twig\TwigTest;
|
|
|
|
class TwigTests extends AbstractExtension
|
|
{
|
|
public function getTests()
|
|
{
|
|
return array(
|
|
new TwigTest('object', [$this, 'isObject']),
|
|
new TwigTest('array', [$this, 'isArray']),
|
|
new TwigTest('numeric', [$this, 'isNumeric']),
|
|
);
|
|
}
|
|
|
|
public function isObject($object)
|
|
{
|
|
return is_object($object);
|
|
}
|
|
|
|
public function isArray($value)
|
|
{
|
|
return is_array($value);
|
|
}
|
|
|
|
public function isNumeric($value)
|
|
{
|
|
return is_numeric($value);
|
|
}
|
|
}
|