|
|
|
|
|
|
|
|
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
|
|
namespace Lc\ShopBundle\Twig; |
|
|
|
|
|
|
|
|
|
|
|
use Lc\ShopBundle\Services\Utils; |
|
|
|
|
|
use Twig\Extension\AbstractExtension; |
|
|
|
|
|
use Twig\TwigFilter; |
|
|
|
|
|
use Twig\TwigFunction; |
|
|
|
|
|
|
|
|
|
|
|
class BridgeTwigExtension extends AbstractExtension |
|
|
|
|
|
{ |
|
|
|
|
|
private $utils ; |
|
|
|
|
|
|
|
|
|
|
|
public function __construct(Utils $utils) |
|
|
|
|
|
{ |
|
|
|
|
|
$this->utils = $utils ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getFunctions() |
|
|
|
|
|
{ |
|
|
|
|
|
return array( |
|
|
|
|
|
new TwigFunction('getDayByNumber', [$this, 'getDayByNumber']), |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getFilters() |
|
|
|
|
|
{ |
|
|
|
|
|
return [ |
|
|
|
|
|
]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getDayByNumber($number) |
|
|
|
|
|
{ |
|
|
|
|
|
return $this->utils->getDayByNumber($number) ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |