Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Apply PHP-CS-Fixer

  • Loading branch information...
commit 6cf5666e98dda36d4705b33503cfd5c1763c6d16 1 parent 0208ca4
@rande rande authored
Showing with 87 additions and 90 deletions.
  1. +0 −3  DependencyInjection/SonataIntlExtension.php
  2. +2 −2 Locale/LocaleDetectorInterface.php
  3. +1 −1  Locale/RequestDetector.php
  4. +2 −2 Locale/SessionDetector.php
  5. +1 −1  Resources/views/CRUD/list_date.html.twig
  6. +1 −1  Resources/views/CRUD/list_datetime.html.twig
  7. +1 −1  Resources/views/CRUD/list_decimal.html.twig
  8. +1 −1  Resources/views/CRUD/list_percent.html.twig
  9. +1 −1  Resources/views/CRUD/show_currency.html.twig
  10. +1 −1  Resources/views/CRUD/show_date.html.twig
  11. +1 −1  Resources/views/CRUD/show_datetime.html.twig
  12. +1 −1  Resources/views/CRUD/show_decimal.html.twig
  13. +1 −1  Resources/views/CRUD/show_percent.html.twig
  14. +1 −1  SonataIntlBundle.php
  15. +2 −3 Templating/Helper/BaseHelper.php
  16. +6 −6 Templating/Helper/DateTimeHelper.php
  17. +4 −4 Templating/Helper/LocaleHelper.php
  18. +39 −39 Templating/Helper/NumberHelper.php
  19. +7 −7 Tests/Helper/LocaleHelperTest.php
  20. +3 −3 Tests/Helper/NumberHelperTest.php
  21. +1 −1  Tests/SonataIntlBundleTest.php
  22. +1 −1  Tests/tests/bootstrap.php
  23. +2 −1  Timezone/LocaleBasedTimezoneDetector.php
  24. +1 −1  Timezone/TimezoneDetectorInterface.php
  25. +1 −1  Twig/Extension/DateTimeExtension.php
  26. +4 −4 Twig/Extension/LocaleExtension.php
  27. +1 −1  Twig/Extension/NumberExtension.php
View
3  DependencyInjection/SonataIntlExtension.php
@@ -8,17 +8,14 @@
* file that was distributed with this source code.
*/
-
namespace Sonata\IntlBundle\DependencyInjection;
use Sonata\IntlBundle\SonataIntlBundle;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
-use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\HttpKernel\Kernel;
View
4 Locale/LocaleDetectorInterface.php
@@ -16,5 +16,5 @@
/**
* @return string
*/
- function getLocale();
-}
+ public function getLocale();
+}
View
2  Locale/RequestDetector.php
@@ -25,7 +25,7 @@ class RequestDetector implements LocaleDetectorInterface
/**
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
- * @param string $defaultLocale
+ * @param string $defaultLocale
*/
public function __construct(ContainerInterface $container, $defaultLocale)
{
View
4 Locale/SessionDetector.php
@@ -23,7 +23,7 @@ class SessionDetector implements LocaleDetectorInterface
/**
* @param \Symfony\Component\HttpFoundation\Session $session
- * @param string $defaultLocale
+ * @param string $defaultLocale
*/
public function __construct(Session $session, $defaultLocale)
{
@@ -46,4 +46,4 @@ public function getLocale()
return $this->defaultLocale;
}
-}
+}
View
2  Resources/views/CRUD/list_date.html.twig
@@ -17,4 +17,4 @@ file that was distributed with this source code.
{%- else -%}
{{ value | format_date }}
{%- endif -%}
-{% endblock %}
+{% endblock %}
View
2  Resources/views/CRUD/list_datetime.html.twig
@@ -17,4 +17,4 @@ file that was distributed with this source code.
{%- else -%}
{{ value | format_datetime }}
{%- endif -%}
-{% endblock %}
+{% endblock %}
View
2  Resources/views/CRUD/list_decimal.html.twig
@@ -16,4 +16,4 @@ file that was distributed with this source code.
{%- else -%}
{{ value | number_format_decimal }}
{%- endif -%}
-{% endblock %}
+{% endblock %}
View
2  Resources/views/CRUD/list_percent.html.twig
@@ -16,4 +16,4 @@ file that was distributed with this source code.
{%- else -%}
{{ value | number_format_percent }}
{%- endif -%}
-{% endblock %}
+{% endblock %}
View
2  Resources/views/CRUD/show_currency.html.twig
@@ -17,4 +17,4 @@ file that was distributed with this source code.
{%- else -%}
{{ value | number_format_currency(field_description.options.currency) }}
{%- endif -%}
-{% endblock %}
+{% endblock %}
View
2  Resources/views/CRUD/show_date.html.twig
@@ -17,4 +17,4 @@ file that was distributed with this source code.
{%- else -%}
{{ value | format_date }}
{%- endif -%}
-{% endblock %}
+{% endblock %}
View
2  Resources/views/CRUD/show_datetime.html.twig
@@ -17,4 +17,4 @@ file that was distributed with this source code.
{%- else -%}
{{ value | format_datetime }}
{%- endif -%}
-{% endblock %}
+{% endblock %}
View
2  Resources/views/CRUD/show_decimal.html.twig
@@ -17,4 +17,4 @@ file that was distributed with this source code.
{%- else -%}
{{ value | number_format_decimal }}
{%- endif -%}
-{% endblock %}
+{% endblock %}
View
2  Resources/views/CRUD/show_percent.html.twig
@@ -17,4 +17,4 @@ file that was distributed with this source code.
{%- else -%}
{{ value | number_format_percent }}
{%- endif -%}
-{% endblock %}
+{% endblock %}
View
2  SonataIntlBundle.php
@@ -26,4 +26,4 @@ public static function getSymfonyVersion($version)
{
return implode('.', array_slice(array_map(function($val) { return (int) $val; }, explode('.', $version)), 0, 3));
}
-}
+}
View
5 Templating/Helper/BaseHelper.php
@@ -11,7 +11,6 @@
namespace Sonata\IntlBundle\Templating\Helper;
-use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Templating\Helper\Helper;
use Sonata\IntlBundle\Locale\LocaleDetectorInterface;
@@ -34,7 +33,7 @@
/**
* Constructor.
*
- * @param string $charset The output charset of the helper
+ * @param string $charset The output charset of the helper
* @param \Sonata\IntlBundle\Locale\LocaleDetectorInterface $localeDetector
*/
public function __construct($charset, LocaleDetectorInterface $localeDetector)
@@ -50,7 +49,7 @@ public function __construct($charset, LocaleDetectorInterface $localeDetector)
*
* Precondition: the kernel charset is not UTF-8
*
- * @param string $string The string to fix
+ * @param string $string The string to fix
* @return string A string with the %kernel.charset% encoding
*/
protected function fixCharset($string)
View
12 Templating/Helper/DateTimeHelper.php
@@ -39,7 +39,7 @@ public function __construct(TimezoneDetectorInterface $timezoneDetector, $charse
/**
* @param \Datetime|string|integer $date
- * @param null|string $locale
+ * @param null|string $locale
* @param null|string timezone
* @param null|integer dateType See \IntlDateFormatter::getDateType
* @return string
@@ -61,7 +61,7 @@ public function formatDate($date, $locale = null, $timezone = null, $dateType =
/**
* @param \Datetime|string|integer $datetime
- * @param null|string $locale
+ * @param null|string $locale
* @param null|string timezone
* @param null|integer dateType See \IntlDateFormatter::getDateType
* @param null|integer timeType See \IntlDateFormatter::getTimeType
@@ -84,7 +84,7 @@ public function formatDateTime($datetime, $locale = null, $timezone = null, $dat
/**
* @param \Datetime|string|integer $time
- * @param null|string $locale
+ * @param null|string $locale
* @param null|string timezone
* @param null|integer timeType See \IntlDateFormatter::getTimeType
* @return string
@@ -128,8 +128,8 @@ public function format($datetime, $pattern, $locale = null, $timezone = null)
}
/**
- * @param \IntlDateFormatter $formatter
- * @param \Datetime $date
+ * @param \IntlDateFormatter $formatter
+ * @param \Datetime $date
* @return string
*/
public function process(\IntlDateFormatter $formatter, \Datetime $date)
@@ -155,7 +155,7 @@ public function getDatetime($data, $timezone = null)
// the format method accept array or integer
if (is_numeric($data)) {
- $data = (int)$data;
+ $data = (int) $data;
}
if (is_string($data)) {
View
8 Templating/Helper/LocaleHelper.php
@@ -22,7 +22,7 @@ class LocaleHelper extends BaseHelper
{
/**
* @param $code
- * @param null $locale
+ * @param null $locale
* @return string
*/
public function country($code, $locale = null)
@@ -38,7 +38,7 @@ public function country($code, $locale = null)
/**
* @param $code
- * @param null $locale
+ * @param null $locale
* @return string
*/
public function language($code, $locale = null)
@@ -54,7 +54,7 @@ public function language($code, $locale = null)
/**
* @param $code
- * @param null $locale
+ * @param null $locale
* @return string
*/
public function locale($code, $locale = null)
@@ -77,4 +77,4 @@ public function getName()
{
return 'sonata_intl_locale';
}
-}
+}
View
78 Templating/Helper/NumberHelper.php
@@ -28,10 +28,10 @@ class NumberHelper extends BaseHelper
/**
* Constructor.
*
- * @param string $charset The output charset of the helper
+ * @param string $charset The output charset of the helper
* @param \Sonata\IntlBundle\Locale\LocaleDetectorInterface $localeDetector
- * @param array $attributes The default attributes to apply to the NumberFormatter instance
- * @param array $textAttributes The default text attributes to apply to the NumberFormatter instance
+ * @param array $attributes The default attributes to apply to the NumberFormatter instance
+ * @param array $textAttributes The default text attributes to apply to the NumberFormatter instance
*/
public function __construct($charset, LocaleDetectorInterface $localeDetector, array $attributes = array(), array $textAttributes = array())
{
@@ -44,10 +44,10 @@ public function __construct($charset, LocaleDetectorInterface $localeDetector, a
/**
* format a value with its percent representation (0.1 => 10%)
*
- * @param float $number
- * @param array $attributes
- * @param array $textAttributes
- * @param null $locale
+ * @param float $number
+ * @param array $attributes
+ * @param array $textAttributes
+ * @param null $locale
* @return string
*/
public function formatPercent($number, array $attributes = array(), array $textAttributes = array(), $locale = null)
@@ -58,10 +58,10 @@ public function formatPercent($number, array $attributes = array(), array $textA
/**
* format a value with its duration representation
*
- * @param float $number
- * @param array $attributes
- * @param array $textAttributes
- * @param null $locale
+ * @param float $number
+ * @param array $attributes
+ * @param array $textAttributes
+ * @param null $locale
* @return string
*/
public function formatDuration($number, array $attributes = array(), array $textAttributes = array(), $locale = null)
@@ -72,10 +72,10 @@ public function formatDuration($number, array $attributes = array(), array $text
/**
* format a value with its decimal representation
*
- * @param float $number
- * @param array $attributes
- * @param array $textAttributes
- * @param null $locale
+ * @param float $number
+ * @param array $attributes
+ * @param array $textAttributes
+ * @param null $locale
* @return string
*/
public function formatDecimal($number, array $attributes = array(), array $textAttributes = array(), $locale = null)
@@ -86,10 +86,10 @@ public function formatDecimal($number, array $attributes = array(), array $textA
/**
* format a value with its spellout representation (1 => one)
*
- * @param float $number
- * @param array $attributes
- * @param array $textAttributes
- * @param null $locale
+ * @param float $number
+ * @param array $attributes
+ * @param array $textAttributes
+ * @param null $locale
* @return string
*/
public function formatSpellout($number, array $attributes = array(), array $textAttributes = array(), $locale = null)
@@ -102,9 +102,9 @@ public function formatSpellout($number, array $attributes = array(), array $text
*
* @param float $number
* @param $currency
- * @param array $attributes
- * @param array $textAttributes
- * @param null $locale
+ * @param array $attributes
+ * @param array $textAttributes
+ * @param null $locale
* @return string
*/
public function formatCurrency($number, $currency, array $attributes = array(), array $textAttributes = array(), $locale = null)
@@ -117,10 +117,10 @@ public function formatCurrency($number, $currency, array $attributes = array(),
/**
* format a value with its scientific representation (10 => 1E1)
*
- * @param float $number
- * @param array $attributes
- * @param array $textAttributes
- * @param null $locale
+ * @param float $number
+ * @param array $attributes
+ * @param array $textAttributes
+ * @param null $locale
* @return string
*/
public function formatScientific($number, array $attributes = array(), array $textAttributes = array(), $locale = null)
@@ -131,10 +131,10 @@ public function formatScientific($number, array $attributes = array(), array $te
/**
* format a value with its ordinal representation
*
- * @param float $number
- * @param array $attributes
- * @param array $textAttributes
- * @param null $locale
+ * @param float $number
+ * @param array $attributes
+ * @param array $textAttributes
+ * @param null $locale
* @return string
*/
public function formatOrdinal($number, array $attributes = array(), array $textAttributes = array(), $locale = null)
@@ -147,9 +147,9 @@ public function formatOrdinal($number, array $attributes = array(), array $textA
*
* @param float $number
* @param integer style
- * @param array $attributes
- * @param array $textAttributes
- * @param null $locale
+ * @param array $attributes
+ * @param array $textAttributes
+ * @param null $locale
* @return string
*/
public function format($number, $style, array $attributes = array(), array $textAttributes = array(), $locale = null)
@@ -162,26 +162,26 @@ public function format($number, $style, array $attributes = array(), array $text
/**
* @param $culture
* @param $style
- * @param array $attributes
- * @param array $textAttributes
+ * @param array $attributes
+ * @param array $textAttributes
* @return \NumberFormatter
*/
protected function getFormatter($culture, $style, $attributes = array(), $textAttributes = array())
{
$formatter = new \NumberFormatter($culture, $style);
- foreach(array_merge($this->textAttributes, $textAttributes) as $name => $value) {
+ foreach (array_merge($this->textAttributes, $textAttributes) as $name => $value) {
$constantName = strtoupper($name);
- if(!defined('NumberFormatter::'.$constantName)) {
+ if (!defined('NumberFormatter::'.$constantName)) {
throw new \InvalidArgumentException("Numberformatter has no text attribute '$name'");
}
$formatter->setTextAttribute(constant('NumberFormatter::'.$constantName), $value);
}
- foreach(array_merge($this->attributes, $attributes) as $name => $value) {
+ foreach (array_merge($this->attributes, $attributes) as $name => $value) {
$constantName = strtoupper($name);
- if(!defined('NumberFormatter::'.$constantName)) {
+ if (!defined('NumberFormatter::'.$constantName)) {
throw new \InvalidArgumentException("Numberformatter has no attribute '$name'");
}
View
14 Tests/Helper/LocaleHelperTest.php
@@ -25,27 +25,27 @@ public function getHelper()
->method('getLocale')->will($this->returnValue('fr'));
$helper = new LocaleHelper('UTF-8', $localeDetector);
-
+
return $helper;
}
-
+
public function testLanguage()
{
$helper = $this->getHelper();
$this->assertEquals('français', $helper->language('fr'));
$this->assertEquals('French', $helper->language('fr', 'en'));
// $this->assertEquals('', $helper->language('fr', 'fake'));
-
+
}
-
+
public function testCountry()
{
$helper = $this->getHelper();
$this->assertEquals('France', $helper->country('FR'));
- $this->assertEquals('France', $helper->country('FR', 'en'));
+ $this->assertEquals('France', $helper->country('FR', 'en'));
// $this->assertEquals('', $helper->country('FR', 'fake'));
}
-
+
public function testLocale()
{
$helper = $this->getHelper();
@@ -59,4 +59,4 @@ public function testLocale()
// $this->assertEquals('', $helper->locale('fr_CA', 'fake'));
}
-}
+}
View
6 Tests/Helper/NumberHelperTest.php
@@ -59,7 +59,7 @@ public function testLocale()
$this->assertEquals('1er', $helper->formatOrdinal(1));
$this->assertEquals('100e', $helper->formatOrdinal(100));
$this->assertEquals('10 000e', $helper->formatOrdinal(10000));
- } else if (version_compare(NumberHelper::getUCIDataVersion(), '4.1.0', '>=')) {
+ } elseif (version_compare(NumberHelper::getUCIDataVersion(), '4.1.0', '>=')) {
$this->assertEquals('1ᵉʳ', $helper->formatOrdinal(1));
$this->assertEquals('100ᵉ', $helper->formatOrdinal(100));
$this->assertEquals('10 000ᵉ', $helper->formatOrdinal(10000));
@@ -88,7 +88,7 @@ public function testArguments()
$exceptionThrown = false;
try {
$helper->formatDecimal(1.337, array('non_existant' => 3));
- } catch(\InvalidArgumentException $e) {
+ } catch (\InvalidArgumentException $e) {
$exceptionThrown = true;
}
$this->assertTrue($exceptionThrown);
@@ -96,7 +96,7 @@ public function testArguments()
$exceptionThrown = false;
try {
$helper->formatDecimal(1.337, array(), array('non_existant' => 'MIN'));
- } catch(\InvalidArgumentException $e) {
+ } catch (\InvalidArgumentException $e) {
$exceptionThrown = true;
}
$this->assertTrue($exceptionThrown);
View
2  Tests/SonataIntlBundleTest.php
@@ -35,4 +35,4 @@ public function testSymfonyVersion($currentVersion, $minVersion, $versionExpecte
$this->assertEquals($versionExpected, version_compare($currentVersion, $minVersion, '>='));
$this->assertEquals($versionBundle, version_compare(SonataIntlBundle::getSymfonyVersion($currentVersion), $minVersion, '>='));
}
-}
+}
View
2  Tests/tests/bootstrap.php
@@ -8,4 +8,4 @@
use Sonata\IntlBundle\Templating\Helper\DateTimeHelper;
-echo sprintf("ICU Version : %s\n", DateTimeHelper::getUCIDataVersion());
+echo sprintf("ICU Version : %s\n", DateTimeHelper::getUCIDataVersion());
View
3  Timezone/LocaleBasedTimezoneDetector.php
@@ -47,7 +47,8 @@ public function __construct(LocaleDetectorInterface $localeDetector, $defaultTim
*
* @return string
*/
- function getTimezone() {
+ public function getTimezone()
+ {
$locale = $this->localeDetector->getLocale();
return isset($this->timezoneMap[$locale]) ? $this->timezoneMap[$locale] : $this->defaultTimezone;
View
2  Timezone/TimezoneDetectorInterface.php
@@ -23,5 +23,5 @@
*
* @return string
*/
- function getTimezone();
+ public function getTimezone();
}
View
2  Twig/Extension/DateTimeExtension.php
@@ -92,4 +92,4 @@ public function getName()
{
return 'sonata_intl_datetime';
}
-}
+}
View
8 Twig/Extension/LocaleExtension.php
@@ -59,7 +59,7 @@ public function getFilters()
* return the localized country name from the provided code
*
* @param $code
- * @param null $locale
+ * @param null $locale
* @return string
*/
public function country($code, $locale = null)
@@ -71,7 +71,7 @@ public function country($code, $locale = null)
* return the localized locale name from the provided code
*
* @param $code
- * @param null $locale
+ * @param null $locale
* @return string
*/
public function locale($code, $locale = null)
@@ -83,7 +83,7 @@ public function locale($code, $locale = null)
* return the localized language name from the provided code
*
* @param $code
- * @param null $locale
+ * @param null $locale
* @return string
*/
public function language($code, $locale = null)
@@ -100,4 +100,4 @@ public function getName()
{
return 'sonata_intl_locale';
}
-}
+}
View
2  Twig/Extension/NumberExtension.php
@@ -104,4 +104,4 @@ public function getName()
{
return 'sonata_intl_number';
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.