@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | |
309 | 309 | private static function standardizeUnit($unit) |
310 | 310 | { |
311 | - $unit = rtrim($unit, 'sz').'s'; |
|
311 | + $unit = rtrim($unit, 'sz') . 's'; |
|
312 | 312 | |
313 | 313 | return $unit === 'days' ? 'dayz' : $unit; |
314 | 314 | } |
@@ -375,25 +375,25 @@ discard block |
||
375 | 375 | if (!\is_string($spec) || (float) $years || preg_match('/^[\d.]/', $years)) { |
376 | 376 | $spec = static::PERIOD_PREFIX; |
377 | 377 | |
378 | - $spec .= $years > 0 ? $years.static::PERIOD_YEARS : ''; |
|
379 | - $spec .= $months > 0 ? $months.static::PERIOD_MONTHS : ''; |
|
378 | + $spec .= $years > 0 ? $years . static::PERIOD_YEARS : ''; |
|
379 | + $spec .= $months > 0 ? $months . static::PERIOD_MONTHS : ''; |
|
380 | 380 | |
381 | 381 | $specDays = 0; |
382 | 382 | $specDays += $weeks > 0 ? $weeks * static::getDaysPerWeek() : 0; |
383 | 383 | $specDays += $days > 0 ? $days : 0; |
384 | 384 | |
385 | - $spec .= $specDays > 0 ? $specDays.static::PERIOD_DAYS : ''; |
|
385 | + $spec .= $specDays > 0 ? $specDays . static::PERIOD_DAYS : ''; |
|
386 | 386 | |
387 | 387 | if ($hours > 0 || $minutes > 0 || $seconds > 0) { |
388 | 388 | $spec .= static::PERIOD_TIME_PREFIX; |
389 | - $spec .= $hours > 0 ? $hours.static::PERIOD_HOURS : ''; |
|
390 | - $spec .= $minutes > 0 ? $minutes.static::PERIOD_MINUTES : ''; |
|
391 | - $spec .= $seconds > 0 ? $seconds.static::PERIOD_SECONDS : ''; |
|
389 | + $spec .= $hours > 0 ? $hours . static::PERIOD_HOURS : ''; |
|
390 | + $spec .= $minutes > 0 ? $minutes . static::PERIOD_MINUTES : ''; |
|
391 | + $spec .= $seconds > 0 ? $seconds . static::PERIOD_SECONDS : ''; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | if ($spec === static::PERIOD_PREFIX) { |
395 | 395 | // Allow the zero interval. |
396 | - $spec .= '0'.static::PERIOD_YEARS; |
|
396 | + $spec .= '0' . static::PERIOD_YEARS; |
|
397 | 397 | } |
398 | 398 | } |
399 | 399 | |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | throw new ParseErrorException( |
596 | 596 | "'$expected'", |
597 | 597 | $nextCharacter, |
598 | - 'Allowed substitutes for interval formats are '.implode(', ', array_keys(static::$formats))."\n". |
|
598 | + 'Allowed substitutes for interval formats are ' . implode(', ', array_keys(static::$formats)) . "\n" . |
|
599 | 599 | 'See https://php.net/manual/en/function.date.php for their meaning' |
600 | 600 | ); |
601 | 601 | } |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | $interval->localStrictModeEnabled = true; |
657 | 657 | |
658 | 658 | $result = static::hasMacro($method) |
659 | - ? static::bindMacroContext(null, function () use (&$method, &$parameters, &$interval) { |
|
659 | + ? static::bindMacroContext(null, function() use (&$method, &$parameters, &$interval) { |
|
660 | 660 | return $interval->callMacro($method, $parameters); |
661 | 661 | }) |
662 | 662 | : $interval->$method(...$parameters); |
@@ -746,9 +746,7 @@ discard block |
||
746 | 746 | } |
747 | 747 | |
748 | 748 | switch ($unit === 'µs' ? 'µs' : strtolower($unit)) { |
749 | - case 'millennia': |
|
750 | - case 'millennium': |
|
751 | - $years += $intValue * CarbonInterface::YEARS_PER_MILLENNIUM; |
|
749 | + case 'millennia' : case 'millennium' : $years += $intValue * CarbonInterface::YEARS_PER_MILLENNIUM; |
|
752 | 750 | |
753 | 751 | break; |
754 | 752 | |
@@ -962,7 +960,7 @@ discard block |
||
962 | 960 | public static function make($interval, $unit = null) |
963 | 961 | { |
964 | 962 | if ($unit) { |
965 | - $interval = "$interval ".Carbon::pluralUnit($unit); |
|
963 | + $interval = "$interval " . Carbon::pluralUnit($unit); |
|
966 | 964 | } |
967 | 965 | |
968 | 966 | if ($interval instanceof DateInterval) { |
@@ -1343,7 +1341,7 @@ discard block |
||
1343 | 1341 | public function __call($method, $parameters) |
1344 | 1342 | { |
1345 | 1343 | if (static::hasMacro($method)) { |
1346 | - return static::bindMacroContext($this, function () use (&$method, &$parameters) { |
|
1344 | + return static::bindMacroContext($this, function() use (&$method, &$parameters) { |
|
1347 | 1345 | return $this->callMacro($method, $parameters); |
1348 | 1346 | }); |
1349 | 1347 | } |
@@ -1410,7 +1408,7 @@ discard block |
||
1410 | 1408 | $minimumUnit = 's'; |
1411 | 1409 | $skip = []; |
1412 | 1410 | extract($this->getForHumansInitialVariables($syntax, $short)); |
1413 | - $skip = array_filter((array) $skip, static function ($value) { |
|
1411 | + $skip = array_filter((array) $skip, static function($value) { |
|
1414 | 1412 | return \is_string($value) && $value !== ''; |
1415 | 1413 | }); |
1416 | 1414 | |
@@ -1447,14 +1445,14 @@ discard block |
||
1447 | 1445 | $optionalSpace = ''; |
1448 | 1446 | } |
1449 | 1447 | |
1450 | - $join = function ($list) use ($default, $last) { |
|
1448 | + $join = function($list) use ($default, $last) { |
|
1451 | 1449 | if (\count($list) < 2) { |
1452 | 1450 | return implode('', $list); |
1453 | 1451 | } |
1454 | 1452 | |
1455 | 1453 | $end = array_pop($list); |
1456 | 1454 | |
1457 | - return implode($default, $list).$last.$end; |
|
1455 | + return implode($default, $list) . $last . $end; |
|
1458 | 1456 | }; |
1459 | 1457 | } |
1460 | 1458 | |
@@ -1464,7 +1462,7 @@ discard block |
||
1464 | 1462 | } |
1465 | 1463 | |
1466 | 1464 | $glue = $join; |
1467 | - $join = function ($list) use ($glue) { |
|
1465 | + $join = function($list) use ($glue) { |
|
1468 | 1466 | return implode($glue, $list); |
1469 | 1467 | }; |
1470 | 1468 | } |
@@ -1623,13 +1621,13 @@ discard block |
||
1623 | 1621 | /** @var \Symfony\Component\Translation\Translator $translator */ |
1624 | 1622 | $translator = $this->getLocalTranslator(); |
1625 | 1623 | |
1626 | - $handleDeclensions = function ($unit, $count, $index = 0, $parts = 1) use ($interpolations, $transId, $translator, $altNumbers, $absolute, &$declensionMode) { |
|
1624 | + $handleDeclensions = function($unit, $count, $index = 0, $parts = 1) use ($interpolations, $transId, $translator, $altNumbers, $absolute, &$declensionMode) { |
|
1627 | 1625 | if (!$absolute) { |
1628 | - $declensionMode = $declensionMode ?? $this->translate($transId.'_mode'); |
|
1626 | + $declensionMode = $declensionMode ?? $this->translate($transId . '_mode'); |
|
1629 | 1627 | |
1630 | 1628 | if ($this->needsDeclension($declensionMode, $index, $parts)) { |
1631 | 1629 | // Some languages have special pluralization for past and future tense. |
1632 | - $key = $unit.'_'.$transId; |
|
1630 | + $key = $unit . '_' . $transId; |
|
1633 | 1631 | $result = $this->translate($key, $interpolations, $count, $translator, $altNumbers); |
1634 | 1632 | |
1635 | 1633 | if ($result !== $key) { |
@@ -1673,14 +1671,14 @@ discard block |
||
1673 | 1671 | } |
1674 | 1672 | |
1675 | 1673 | $diffIntervalArray = [ |
1676 | - ['value' => $intervalValues->years, 'unit' => 'year', 'unitShort' => 'y'], |
|
1677 | - ['value' => $intervalValues->months, 'unit' => 'month', 'unitShort' => 'm'], |
|
1678 | - ['value' => $intervalValues->weeks, 'unit' => 'week', 'unitShort' => 'w'], |
|
1679 | - ['value' => $intervalValues->daysExcludeWeeks, 'unit' => 'day', 'unitShort' => 'd'], |
|
1680 | - ['value' => $intervalValues->hours, 'unit' => 'hour', 'unitShort' => 'h'], |
|
1681 | - ['value' => $intervalValues->minutes, 'unit' => 'minute', 'unitShort' => 'min'], |
|
1682 | - ['value' => $intervalValues->seconds, 'unit' => 'second', 'unitShort' => 's'], |
|
1683 | - ['value' => $intervalValues->milliseconds, 'unit' => 'millisecond', 'unitShort' => 'ms'], |
|
1674 | + ['value' => $intervalValues->years, 'unit' => 'year', 'unitShort' => 'y'], |
|
1675 | + ['value' => $intervalValues->months, 'unit' => 'month', 'unitShort' => 'm'], |
|
1676 | + ['value' => $intervalValues->weeks, 'unit' => 'week', 'unitShort' => 'w'], |
|
1677 | + ['value' => $intervalValues->daysExcludeWeeks, 'unit' => 'day', 'unitShort' => 'd'], |
|
1678 | + ['value' => $intervalValues->hours, 'unit' => 'hour', 'unitShort' => 'h'], |
|
1679 | + ['value' => $intervalValues->minutes, 'unit' => 'minute', 'unitShort' => 'min'], |
|
1680 | + ['value' => $intervalValues->seconds, 'unit' => 'second', 'unitShort' => 's'], |
|
1681 | + ['value' => $intervalValues->milliseconds, 'unit' => 'millisecond', 'unitShort' => 'ms'], |
|
1684 | 1682 | ['value' => $intervalValues->microExcludeMilli, 'unit' => 'microsecond', 'unitShort' => 'µs'], |
1685 | 1683 | ]; |
1686 | 1684 | |
@@ -1690,7 +1688,7 @@ discard block |
||
1690 | 1688 | |
1691 | 1689 | if ($unitData['value'] && |
1692 | 1690 | isset($diffIntervalArray[$nextIndex]) && |
1693 | - \count(array_intersect([$unitData['unit'], $unitData['unit'].'s', $unitData['unitShort']], $skip)) |
|
1691 | + \count(array_intersect([$unitData['unit'], $unitData['unit'] . 's', $unitData['unitShort']], $skip)) |
|
1694 | 1692 | ) { |
1695 | 1693 | $diffIntervalArray[$nextIndex]['value'] += $unitData['value'] * |
1696 | 1694 | self::getFactorWithDefault($diffIntervalArray[$nextIndex]['unit'], $unitData['unit']); |
@@ -1699,7 +1697,7 @@ discard block |
||
1699 | 1697 | } |
1700 | 1698 | } |
1701 | 1699 | |
1702 | - $transChoice = function ($short, $unitData, $index, $parts) use ($absolute, $handleDeclensions, $translator, $aUnit, $altNumbers, $interpolations) { |
|
1700 | + $transChoice = function($short, $unitData, $index, $parts) use ($absolute, $handleDeclensions, $translator, $aUnit, $altNumbers, $interpolations) { |
|
1703 | 1701 | $count = $unitData['value']; |
1704 | 1702 | |
1705 | 1703 | if ($short) { |
@@ -1709,7 +1707,7 @@ discard block |
||
1709 | 1707 | return $result; |
1710 | 1708 | } |
1711 | 1709 | } elseif ($aUnit) { |
1712 | - $result = $handleDeclensions('a_'.$unitData['unit'], $count, $index, $parts); |
|
1710 | + $result = $handleDeclensions('a_' . $unitData['unit'], $count, $index, $parts); |
|
1713 | 1711 | |
1714 | 1712 | if ($result !== null) { |
1715 | 1713 | return $result; |
@@ -1802,7 +1800,7 @@ discard block |
||
1802 | 1800 | } |
1803 | 1801 | } |
1804 | 1802 | |
1805 | - $aTime = $aUnit ? $handleDeclensions('a_'.$unit, $count) : null; |
|
1803 | + $aTime = $aUnit ? $handleDeclensions('a_' . $unit, $count) : null; |
|
1806 | 1804 | |
1807 | 1805 | $time = $aTime ?: $handleDeclensions($unit, $count) ?: $time; |
1808 | 1806 | } |
@@ -2172,13 +2170,13 @@ discard block |
||
2172 | 2170 | $specString = static::PERIOD_PREFIX; |
2173 | 2171 | |
2174 | 2172 | foreach ($date as $key => $value) { |
2175 | - $specString .= $value.$key; |
|
2173 | + $specString .= $value . $key; |
|
2176 | 2174 | } |
2177 | 2175 | |
2178 | 2176 | if (\count($time) > 0) { |
2179 | 2177 | $specString .= static::PERIOD_TIME_PREFIX; |
2180 | 2178 | foreach ($time as $key => $value) { |
2181 | - $specString .= $value.$key; |
|
2179 | + $specString .= $value . $key; |
|
2182 | 2180 | } |
2183 | 2181 | } |
2184 | 2182 | |
@@ -2233,7 +2231,7 @@ discard block |
||
2233 | 2231 | |
2234 | 2232 | private function invertCascade(array $values) |
2235 | 2233 | { |
2236 | - return $this->set(array_map(function ($value) { |
|
2234 | + return $this->set(array_map(function($value) { |
|
2237 | 2235 | return -$value; |
2238 | 2236 | }, $values))->doCascade(true)->invert(); |
2239 | 2237 | } |
@@ -383,9 +383,9 @@ discard block |
||
383 | 383 | $type = \gettype($period); |
384 | 384 | |
385 | 385 | throw new NotAPeriodException( |
386 | - 'Argument 1 passed to '.$class.'::'.__METHOD__.'() '. |
|
387 | - 'must be an instance of DatePeriod or '.$class.', '. |
|
388 | - ($type === 'object' ? 'instance of '.\get_class($period) : $type).' given.' |
|
386 | + 'Argument 1 passed to ' . $class . '::' . __METHOD__ . '() ' . |
|
387 | + 'must be an instance of DatePeriod or ' . $class . ', ' . |
|
388 | + ($type === 'object' ? 'instance of ' . \get_class($period) : $type) . ' given.' |
|
389 | 389 | ); |
390 | 390 | } |
391 | 391 | |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | */ |
515 | 515 | protected static function addMissingParts($source, $target) |
516 | 516 | { |
517 | - $pattern = '/'.preg_replace('/\d+/', '[0-9]+', preg_quote($target, '/')).'$/'; |
|
517 | + $pattern = '/' . preg_replace('/\d+/', '[0-9]+', preg_quote($target, '/')) . '$/'; |
|
518 | 518 | |
519 | 519 | $result = preg_replace($pattern, $target, $source, 1, $count); |
520 | 520 | |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | $date = new static(); |
607 | 607 | |
608 | 608 | if (static::hasMacro($method)) { |
609 | - return static::bindMacroContext(null, function () use (&$method, &$parameters, &$date) { |
|
609 | + return static::bindMacroContext(null, function() use (&$method, &$parameters, &$date) { |
|
610 | 610 | return $date->callMacro($method, $parameters); |
611 | 611 | }); |
612 | 612 | } |
@@ -931,8 +931,7 @@ discard block |
||
931 | 931 | |
932 | 932 | return $this->setOptions( |
933 | 933 | $state ? |
934 | - $this->options | $options : |
|
935 | - $this->options & ~$options |
|
934 | + $this->options | $options : $this->options & ~$options |
|
936 | 935 | ); |
937 | 936 | } |
938 | 937 | |
@@ -1144,7 +1143,7 @@ discard block |
||
1144 | 1143 | |
1145 | 1144 | $this->filters = array_values(array_filter( |
1146 | 1145 | $this->filters, |
1147 | - function ($tuple) use ($key, $filter) { |
|
1146 | + function($tuple) use ($key, $filter) { |
|
1148 | 1147 | return $tuple[$key] !== $filter; |
1149 | 1148 | } |
1150 | 1149 | )); |
@@ -1438,7 +1437,7 @@ discard block |
||
1438 | 1437 | $parts = []; |
1439 | 1438 | |
1440 | 1439 | if ($this->recurrences !== null) { |
1441 | - $parts[] = 'R'.$this->recurrences; |
|
1440 | + $parts[] = 'R' . $this->recurrences; |
|
1442 | 1441 | } |
1443 | 1442 | |
1444 | 1443 | $parts[] = $this->startDate->toIso8601String(); |
@@ -1483,7 +1482,7 @@ discard block |
||
1483 | 1482 | |
1484 | 1483 | $result = implode(' ', $parts); |
1485 | 1484 | |
1486 | - return mb_strtoupper(mb_substr($result, 0, 1)).mb_substr($result, 1); |
|
1485 | + return mb_strtoupper(mb_substr($result, 0, 1)) . mb_substr($result, 1); |
|
1487 | 1486 | } |
1488 | 1487 | |
1489 | 1488 | /** |
@@ -1664,7 +1663,7 @@ discard block |
||
1664 | 1663 | public function __call($method, $parameters) |
1665 | 1664 | { |
1666 | 1665 | if (static::hasMacro($method)) { |
1667 | - return static::bindMacroContext($this, function () use (&$method, &$parameters) { |
|
1666 | + return static::bindMacroContext($this, function() use (&$method, &$parameters) { |
|
1668 | 1667 | return $this->callMacro($method, $parameters); |
1669 | 1668 | }); |
1670 | 1669 | } |
@@ -1836,7 +1835,7 @@ discard block |
||
1836 | 1835 | { |
1837 | 1836 | if ($this->recurrences === null) { |
1838 | 1837 | throw new UnreachableException( |
1839 | - "Could not calculate period end without either explicit end or recurrences.\n". |
|
1838 | + "Could not calculate period end without either explicit end or recurrences.\n" . |
|
1840 | 1839 | "If you're looking for a forever-period, use ->setRecurrences(INF)." |
1841 | 1840 | ); |
1842 | 1841 | } |
@@ -1871,7 +1870,7 @@ discard block |
||
1871 | 1870 | foreach ($this as $date) { |
1872 | 1871 | if (++$attempts > static::END_MAX_ATTEMPTS) { |
1873 | 1872 | throw new UnreachableException( |
1874 | - 'Could not calculate period end after iterating '.static::END_MAX_ATTEMPTS.' times.' |
|
1873 | + 'Could not calculate period end after iterating ' . static::END_MAX_ATTEMPTS . ' times.' |
|
1875 | 1874 | ); |
1876 | 1875 | } |
1877 | 1876 | } |
@@ -1914,7 +1913,7 @@ discard block |
||
1914 | 1913 | * |
1915 | 1914 | * @param callable $callback |
1916 | 1915 | */ |
1917 | - public function forEach(callable $callback) |
|
1916 | + public function forEach (callable $callback) |
|
1918 | 1917 | { |
1919 | 1918 | foreach ($this as $date) { |
1920 | 1919 | $callback($date); |
@@ -2282,8 +2281,8 @@ discard block |
||
2282 | 2281 | */ |
2283 | 2282 | public function contains($date = null): bool |
2284 | 2283 | { |
2285 | - $startMethod = 'startsBefore'.($this->isStartIncluded() ? 'OrAt' : ''); |
|
2286 | - $endMethod = 'endsAfter'.($this->isEndIncluded() ? 'OrAt' : ''); |
|
2284 | + $startMethod = 'startsBefore' . ($this->isStartIncluded() ? 'OrAt' : ''); |
|
2285 | + $endMethod = 'endsAfter' . ($this->isEndIncluded() ? 'OrAt' : ''); |
|
2287 | 2286 | |
2288 | 2287 | return $this->$startMethod($date) && $this->$endMethod($date); |
2289 | 2288 | } |
@@ -2368,7 +2367,7 @@ discard block |
||
2368 | 2367 | return [$method, array_shift($parameters)]; |
2369 | 2368 | } |
2370 | 2369 | |
2371 | - return [function ($date) use ($method, $parameters) { |
|
2370 | + return [function($date) use ($method, $parameters) { |
|
2372 | 2371 | return ([$date, $method])(...$parameters); |
2373 | 2372 | }, $method]; |
2374 | 2373 | } |
@@ -301,7 +301,7 @@ |
||
301 | 301 | $settings = $this->settings; |
302 | 302 | |
303 | 303 | if ($settings && isset($settings['timezone'])) { |
304 | - $tzParameters = array_filter($method->getParameters(), function ($parameter) { |
|
304 | + $tzParameters = array_filter($method->getParameters(), function($parameter) { |
|
305 | 305 | return \in_array($parameter->getName(), ['tz', 'timezone'], true); |
306 | 306 | }); |
307 | 307 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | throw new InvalidTimeZoneException('Absolute timezone offset cannot be greater than 100.'); |
31 | 31 | } |
32 | 32 | |
33 | - return ($timezone >= 0 ? '+' : '').ltrim($timezone, '+').':00'; |
|
33 | + return ($timezone >= 0 ? '+' : '') . ltrim($timezone, '+') . ':00'; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | protected static function getDateTimeZoneNameFromMixed($timezone) |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | if (Carbon::isStrictModeEnabled()) { |
109 | - throw new InvalidTimeZoneException('Unknown or bad timezone ('.($objectDump ?: $object).')'); |
|
109 | + throw new InvalidTimeZoneException('Unknown or bad timezone (' . ($objectDump ?: $object) . ')'); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | return false; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | } |
237 | 237 | |
238 | 238 | if (Carbon::isStrictModeEnabled()) { |
239 | - throw new InvalidTimeZoneException('Unknown timezone for offset '.$this->getOffset($date ?: Carbon::now($this)).' seconds.'); |
|
239 | + throw new InvalidTimeZoneException('Unknown timezone for offset ' . $this->getOffset($date ?: Carbon::now($this)) . ' seconds.'); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | return false; |
@@ -312,9 +312,9 @@ discard block |
||
312 | 312 | $minutes = round($minutes); |
313 | 313 | $unsignedMinutes = abs($minutes); |
314 | 314 | |
315 | - return ($minutes < 0 ? '-' : '+'). |
|
316 | - str_pad((string) floor($unsignedMinutes / 60), 2, '0', STR_PAD_LEFT). |
|
317 | - ':'. |
|
315 | + return ($minutes < 0 ? '-' : '+') . |
|
316 | + str_pad((string) floor($unsignedMinutes / 60), 2, '0', STR_PAD_LEFT) . |
|
317 | + ':' . |
|
318 | 318 | str_pad((string) ($unsignedMinutes % 60), 2, '0', STR_PAD_LEFT); |
319 | 319 | } |
320 | 320 | } |
@@ -23,8 +23,8 @@ |
||
23 | 23 | ); |
24 | 24 | |
25 | 25 | require $transMethod->hasReturnType() |
26 | - ? __DIR__.'/../../lazy/Carbon/TranslatorStrongType.php' |
|
27 | - : __DIR__.'/../../lazy/Carbon/TranslatorWeakType.php'; |
|
26 | + ? __DIR__ . '/../../lazy/Carbon/TranslatorStrongType.php' |
|
27 | + : __DIR__ . '/../../lazy/Carbon/TranslatorWeakType.php'; |
|
28 | 28 | |
29 | 29 | class Translator extends LazyTranslator |
30 | 30 | { |
@@ -91,7 +91,7 @@ |
||
91 | 91 | throw ConversionException::conversionFailedFormat( |
92 | 92 | $value, |
93 | 93 | $this->getName(), |
94 | - 'Y-m-d H:i:s.u or any format supported by '.$class.'::parse()', |
|
94 | + 'Y-m-d H:i:s.u or any format supported by ' . $class . '::parse()', |
|
95 | 95 | $error |
96 | 96 | ); |
97 | 97 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public static function all() |
87 | 87 | { |
88 | 88 | if (!static::$languagesNames) { |
89 | - static::$languagesNames = require __DIR__.'/List/languages.php'; |
|
89 | + static::$languagesNames = require __DIR__ . '/List/languages.php'; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return static::$languagesNames; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | public static function regions() |
101 | 101 | { |
102 | 102 | if (!static::$regionsNames) { |
103 | - static::$regionsNames = require __DIR__.'/List/regions.php'; |
|
103 | + static::$regionsNames = require __DIR__ . '/List/regions.php'; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | return static::$regionsNames; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $region = $this->getRegionName(); |
278 | 278 | $variant = $this->getVariantName(); |
279 | 279 | |
280 | - return $this->getIsoName().($region ? ' ('.$region.')' : '').($variant ? ' ('.$variant.')' : ''); |
|
280 | + return $this->getIsoName() . ($region ? ' (' . $region . ')' : '') . ($variant ? ' (' . $variant . ')' : ''); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $region = $this->getRegionName(); |
291 | 291 | $variant = $this->getVariantName(); |
292 | 292 | |
293 | - return $this->getNativeName().($region ? ' ('.$region.')' : '').($variant ? ' ('.$variant.')' : ''); |
|
293 | + return $this->getNativeName() . ($region ? ' (' . $region . ')' : '') . ($variant ? ' (' . $variant . ')' : ''); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $region = $this->getRegionName(); |
304 | 304 | $variant = $this->getVariantName(); |
305 | 305 | |
306 | - return $this->getFullIsoName().($region ? ' ('.$region.')' : '').($variant ? ' ('.$variant.')' : ''); |
|
306 | + return $this->getFullIsoName() . ($region ? ' (' . $region . ')' : '') . ($variant ? ' (' . $variant . ')' : ''); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | /** |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $region = $this->getRegionName(); |
317 | 317 | $variant = $this->getVariantName(); |
318 | 318 | |
319 | - return $this->getFullNativeName().($region ? ' ('.$region.')' : '').($variant ? ' ('.$variant.')' : ''); |
|
319 | + return $this->getFullNativeName() . ($region ? ' (' . $region . ')' : '') . ($variant ? ' (' . $variant . ')' : ''); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public static function get($locale = null) |
69 | 69 | { |
70 | 70 | $locale = $locale ?: 'en'; |
71 | - $key = static::class === Translator::class ? $locale : static::class.'|'.$locale; |
|
71 | + $key = static::class === Translator::class ? $locale : static::class . '|' . $locale; |
|
72 | 72 | |
73 | 73 | if (!isset(static::$singletons[$key])) { |
74 | 74 | static::$singletons[$key] = new static($locale); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | { |
82 | 82 | parent::setLocale($locale); |
83 | 83 | $this->initializing = true; |
84 | - $this->directories = [__DIR__.'/Lang']; |
|
84 | + $this->directories = [__DIR__ . '/Lang']; |
|
85 | 85 | $this->addLoader('array', new ArrayLoader()); |
86 | 86 | parent::__construct($locale, $formatter, $cacheDir, $debug); |
87 | 87 | $this->initializing = false; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | { |
137 | 137 | $search = rtrim(strtr($directory, '\\', '/'), '/'); |
138 | 138 | |
139 | - return $this->setDirectories(array_filter($this->getDirectories(), function ($item) use ($search) { |
|
139 | + return $this->setDirectories(array_filter($this->getDirectories(), function($item) use ($search) { |
|
140 | 140 | return rtrim(strtr($item, '\\', '/'), '/') !== $search; |
141 | 141 | })); |
142 | 142 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | */ |
308 | 308 | public function setLocale($locale) |
309 | 309 | { |
310 | - $locale = preg_replace_callback('/[-_]([a-z]{2,}|\d{2,})/', function ($matches) { |
|
310 | + $locale = preg_replace_callback('/[-_]([a-z]{2,}|\d{2,})/', function($matches) { |
|
311 | 311 | // _2-letters or YUE is a region, _3+-letters is a variant |
312 | 312 | $upper = strtoupper($matches[1]); |
313 | 313 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | return "_$upper"; |
316 | 316 | } |
317 | 317 | |
318 | - return '_'.ucfirst($matches[1]); |
|
318 | + return '_' . ucfirst($matches[1]); |
|
319 | 319 | }, strtolower($locale)); |
320 | 320 | |
321 | 321 | $previousLocale = $this->getLocale(); |
@@ -333,11 +333,11 @@ discard block |
||
333 | 333 | |
334 | 334 | $completeLocaleChunks = preg_split('/[_.-]+/', $completeLocale); |
335 | 335 | |
336 | - $getScore = function ($language) use ($completeLocaleChunks) { |
|
336 | + $getScore = function($language) use ($completeLocaleChunks) { |
|
337 | 337 | return self::compareChunkLists($completeLocaleChunks, preg_split('/[_.-]+/', $language)); |
338 | 338 | }; |
339 | 339 | |
340 | - usort($locales, function ($first, $second) use ($getScore) { |
|
340 | + usort($locales, function($first, $second) use ($getScore) { |
|
341 | 341 | return $getScore($second) <=> $getScore($first); |
342 | 342 | }); |
343 | 343 |
@@ -42,7 +42,7 @@ |
||
42 | 42 | { |
43 | 43 | $this->field = $field; |
44 | 44 | $this->value = $value; |
45 | - parent::__construct($field.' : '.$value.' is not a valid value.', $code, $previous); |
|
45 | + parent::__construct($field . ' : ' . $value . ' is not a valid value.', $code, $previous); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |