for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\AddressingBundle\Twig;
use Sylius\Component\Addressing\Provider\ProvinceNamingProviderInterface;
/**
* @author Jan Góralski <[email protected]>
class ProvinceNamingExtension extends \Twig_Extension
{
* @var ProvinceNamingProviderInterface
private $provinceNamingProvider;
* @param ProvinceNamingProviderInterface $provinceNamingProvider
public function __construct(ProvinceNamingProviderInterface $provinceNamingProvider)
$this->provinceNamingProvider = $provinceNamingProvider;
}
* {@inheritdoc}
public function getFilters()
return array(
new \Twig_SimpleFilter('sylius_province_name', array($this, 'getProvinceName')),
new \Twig_SimpleFilter('sylius_province_abbreviation', array($this, 'getProvinceAbbreviation')),
);
* @param string $provinceCode
* @return string
public function getProvinceName($provinceCode)
return $this->provinceNamingProvider->getName($provinceCode);
public function getProvinceAbbreviation($provinceCode)
return $this->provinceNamingProvider->getAbbreviation($provinceCode);
public function getName()
return 'sylius_province_naming';