Skip to content

Commit

Permalink
Merge pull request #7559 from pamil/twig-extension-names
Browse files Browse the repository at this point in the history
Improve Twig extensions
  • Loading branch information
pjedrzejewski committed Feb 20, 2017
2 parents 4450026 + 7e5f727 commit 07153d4
Show file tree
Hide file tree
Showing 23 changed files with 5 additions and 485 deletions.
Expand Up @@ -43,12 +43,4 @@ public function translateCountryIsoCode($country, $locale = null)

return Intl::getRegionBundle()->getCountryName($country, $locale);
}

/**
* {@inheritdoc}
*/
public function getName()
{
return 'sylius_country_name';
}
}
Expand Up @@ -38,36 +38,8 @@ public function __construct(ProvinceNamingProviderInterface $provinceNamingProvi
public function getFilters()
{
return [
new \Twig_SimpleFilter('sylius_province_name', [$this, 'getProvinceName']),
new \Twig_SimpleFilter('sylius_province_abbreviation', [$this, 'getProvinceAbbreviation']),
new \Twig_SimpleFilter('sylius_province_name', [$this->provinceNamingProvider, 'getName']),
new \Twig_SimpleFilter('sylius_province_abbreviation', [$this->provinceNamingProvider, 'getAbbreviation']),
];
}

/**
* @param AddressInterface $address
*
* @return string
*/
public function getProvinceName(AddressInterface $address)
{
return $this->provinceNamingProvider->getName($address);
}

/**
* @param AddressInterface $address
*
* @return string
*/
public function getProvinceAbbreviation(AddressInterface $address)
{
return $this->provinceNamingProvider->getAbbreviation($address);
}

/**
* {@inheritdoc}
*/
public function getName()
{
return 'sylius_province_naming';
}
}
Expand Up @@ -20,14 +20,9 @@
*/
final class CountryNameExtensionSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType(CountryNameExtension::class);
}

function it_is_a_twig_extension()
{
$this->shouldHaveType('Twig_Extension');
$this->shouldHaveType(\Twig_Extension::class);
}

function it_translates_country_iso_code_into_name()
Expand All @@ -46,9 +41,4 @@ function it_translates_country_code_to_name_according_to_locale()
{
$this->translateCountryIsoCode('IE', 'es')->shouldReturn('Irlanda');
}

function it_has_name()
{
$this->getName()->shouldReturn('sylius_country_name');
}
}

This file was deleted.

8 changes: 0 additions & 8 deletions src/Sylius/Bundle/CoreBundle/Twig/CheckoutStepsExtension.php
Expand Up @@ -41,12 +41,4 @@ public function getFunctions()
new \Twig_SimpleFunction('sylius_is_payment_required', [$this->checkoutStepsHelper, 'isPaymentRequired']),
];
}

/**
* {@inheritdoc}
*/
public function getName()
{
return 'sylius_shipping_steps';
}
}
8 changes: 0 additions & 8 deletions src/Sylius/Bundle/CoreBundle/Twig/PriceExtension.php
Expand Up @@ -40,12 +40,4 @@ public function getFilters()
new \Twig_SimpleFilter('sylius_calculate_price', [$this->helper, 'getPrice']),
];
}

/**
* {@inheritdoc}
*/
public function getName()
{
return 'sylius_calculate_price';
}
}
Expand Up @@ -40,12 +40,4 @@ public function getFunctions()
new \Twig_SimpleFunction('sylius_product_variant_prices', [$this->productVariantsPricesHelper, 'getPrices']),
];
}

/**
* {@inheritdoc}
*/
public function getName()
{
return 'sylius_product_variant_prices';
}
}
Expand Up @@ -40,12 +40,4 @@ public function getFilters()
new \Twig_SimpleFilter('sylius_resolve_variant', [$this->helper, 'resolveVariant']),
];
}

/**
* {@inheritdoc}
*/
public function getName()
{
return 'sylius_resolve_variant';
}
}

This file was deleted.

8 changes: 0 additions & 8 deletions src/Sylius/Bundle/CurrencyBundle/Twig/CurrencyExtension.php
Expand Up @@ -40,12 +40,4 @@ public function getFilters()
new \Twig_SimpleFilter('sylius_currency_symbol', [$this->helper, 'convertCurrencyCodeToSymbol']),
];
}

/**
* {@inheritdoc}
*/
public function getName()
{
return 'sylius_currency';
}
}
8 changes: 0 additions & 8 deletions src/Sylius/Bundle/GridBundle/Twig/GridExtension.php
Expand Up @@ -43,12 +43,4 @@ public function getFunctions()
new \Twig_SimpleFunction('sylius_grid_render_filter', [$this->gridHelper, 'renderFilter'], ['is_safe' => ['html']]),
];
}

/**
* @return string
*/
public function getName()
{
return 'sylius_grid';
}
}
8 changes: 0 additions & 8 deletions src/Sylius/Bundle/InventoryBundle/Twig/InventoryExtension.php
Expand Up @@ -41,12 +41,4 @@ public function getFunctions()
new \Twig_SimpleFunction('sylius_inventory_is_sufficient', [$this->helper, 'isStockSufficient']),
];
}

/**
* {@inheritdoc}
*/
public function getName()
{
return 'sylius_inventory';
}
}

This file was deleted.

8 changes: 0 additions & 8 deletions src/Sylius/Bundle/LocaleBundle/Twig/LocaleExtension.php
Expand Up @@ -41,12 +41,4 @@ public function getFilters()
new \Twig_SimpleFilter('sylius_locale_name', [$this->localeHelper, 'convertCodeToName']),
];
}

/**
* {@inheritdoc}
*/
public function getName()
{
return 'sylius_locale';
}
}
37 changes: 0 additions & 37 deletions src/Sylius/Bundle/LocaleBundle/spec/Twig/LocaleExtensionSpec.php

This file was deleted.

0 comments on commit 07153d4

Please sign in to comment.