@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @var array |
| 70 | 70 | */ |
| 71 | - protected $supportedFormats = [ 'ini', 'csv', 'json', 'php', 'yaml', 'yml' ]; |
|
| 71 | + protected $supportedFormats = ['ini', 'csv', 'json', 'php', 'yaml', 'yml']; |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * A list of available file formats. |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | $directory = new RecursiveDirectoryIterator($path); |
| 294 | 294 | $filter = new RecursiveCallbackFilterIterator( |
| 295 | 295 | $directory, |
| 296 | - function ($current, $key, $iterator) { |
|
| 296 | + function($current, $key, $iterator) { |
|
| 297 | 297 | $filename = $current->getFilename(); |
| 298 | 298 | if (preg_match('!^(\.\w+|\.$|\.\.$)!i', $filename)) { |
| 299 | 299 | return false; |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | protected function createTranslationCatalog() |
| 387 | 387 | { |
| 388 | 388 | $catalogClass = $this->catalogClass(); |
| 389 | - $catalog = new $catalogClass; |
|
| 389 | + $catalog = new $catalogClass; |
|
| 390 | 390 | |
| 391 | 391 | if (!$catalog instanceof CatalogInterface) { |
| 392 | 392 | throw new RuntimeException( |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | public function createTranslationResource() |
| 440 | 440 | { |
| 441 | 441 | $resourceClass = $this->resourceClass(); |
| 442 | - $resource = new $resourceClass; |
|
| 442 | + $resource = new $resourceClass; |
|
| 443 | 443 | |
| 444 | 444 | if (!$resource instanceof ResourceInterface) { |
| 445 | 445 | throw new RuntimeException( |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $messages = []; |
| 123 | 123 | |
| 124 | 124 | $i = 0; |
| 125 | - $blank = [ null ]; |
|
| 125 | + $blank = [null]; |
|
| 126 | 126 | // @codingStandardsIgnoreStart |
| 127 | 127 | while (($data = fgetcsv($handle)) !== false) { |
| 128 | 128 | // @codingStandardsIgnoreEnd |
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | if ($i === 0) { |
| 134 | 134 | $i++; |
| 135 | 135 | |
| 136 | - $source = $data[0]; |
|
| 136 | + $source = $data[0]; |
|
| 137 | 137 | $count = count($data); |
| 138 | - $context = $data[( $count-1 )]; |
|
| 138 | + $context = $data[($count - 1)]; |
|
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | 141 | * Remove "ident" and "context" columns. |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | } else { |
| 524 | 524 | $messages[$id] = [ |
| 525 | 525 | 'translations' => [], |
| 526 | - 'context' => [ $context ], |
|
| 526 | + 'context' => [$context], |
|
| 527 | 527 | 'status' => 'new' |
| 528 | 528 | ]; |
| 529 | 529 | } |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | sprintf( |
| 601 | 601 | 'Supported source types are: %1$s; received %2$s'. |
| 602 | 602 | 'Unsupported file type "%1$s". Must be one of %2$s', |
| 603 | - implode(', ', [ 'mustache', 'php' ]), |
|
| 603 | + implode(', ', ['mustache', 'php']), |
|
| 604 | 604 | (is_object($type) ? get_class($type) : gettype($type)) |
| 605 | 605 | ) |
| 606 | 606 | ); |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | static $arguments; |
| 622 | 622 | |
| 623 | 623 | if ($arguments === null) { |
| 624 | - $validateLanguages = function ($response) { |
|
| 624 | + $validateLanguages = function($response) { |
|
| 625 | 625 | if (strlen($response) === 0) { |
| 626 | 626 | return true; |
| 627 | 627 | } |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | }; |
| 638 | 638 | $validateLanguages = $validateLanguages->bindTo($this); |
| 639 | 639 | |
| 640 | - $validatePaths = function ($response) { |
|
| 640 | + $validatePaths = function($response) { |
|
| 641 | 641 | if (strlen($response) === 0) { |
| 642 | 642 | return true; |
| 643 | 643 | } |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | }; |
| 654 | 654 | $validatePaths = $validatePaths->bindTo($this); |
| 655 | 655 | |
| 656 | - $validateCatalog = function ($response) { |
|
| 656 | + $validateCatalog = function($response) { |
|
| 657 | 657 | if (strlen($response) === 0) { |
| 658 | 658 | return true; |
| 659 | 659 | } |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | 'A negative value means no limit.', |
| 678 | 678 | 'defaultValue' => static::DEFAULT_MAX_DEPTH, |
| 679 | 679 | 'prompt' => 'Scan Depth (of directories)', |
| 680 | - 'acceptValue' => function ($response) { |
|
| 680 | + 'acceptValue' => function($response) { |
|
| 681 | 681 | return (strlen($response) === 0) || is_numeric($response); |
| 682 | 682 | } |
| 683 | 683 | ], |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | 'description' => 'Specify an alternate base path.', |
| 689 | 689 | 'defaultValue' => $this->basePath(), |
| 690 | 690 | 'prompt' => 'Base Path', |
| 691 | - 'acceptValue' => function ($response) { |
|
| 691 | + 'acceptValue' => function($response) { |
|
| 692 | 692 | return (strlen($response) === 0) || is_dir($response); |
| 693 | 693 | } |
| 694 | 694 | ], |
@@ -968,7 +968,7 @@ discard block |
||
| 968 | 968 | */ |
| 969 | 969 | public function outputFormats() |
| 970 | 970 | { |
| 971 | - return [ 'csv' ]; |
|
| 971 | + return ['csv']; |
|
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | /** |
@@ -1220,7 +1220,7 @@ discard block |
||
| 1220 | 1220 | $languages = []; |
| 1221 | 1221 | |
| 1222 | 1222 | $r = 0; |
| 1223 | - $blank = [ null ]; |
|
| 1223 | + $blank = [null]; |
|
| 1224 | 1224 | // @codingStandardsIgnoreStart |
| 1225 | 1225 | while (($row = fgetcsv($file)) !== false) { |
| 1226 | 1226 | // @codingStandardsIgnoreEnd |
@@ -1308,7 +1308,7 @@ discard block |
||
| 1308 | 1308 | fputcsv($file, $this->csvHeaderRow()); |
| 1309 | 1309 | |
| 1310 | 1310 | foreach ($messages as $id => $entry) { |
| 1311 | - $row = [ $id ]; |
|
| 1311 | + $row = [$id]; |
|
| 1312 | 1312 | foreach ($languages as $lang) { |
| 1313 | 1313 | if (isset($entry['translations'][$lang])) { |
| 1314 | 1314 | $row[] = $entry['translations'][$lang]; |
@@ -1387,7 +1387,7 @@ discard block |
||
| 1387 | 1387 | static $columns; |
| 1388 | 1388 | |
| 1389 | 1389 | if ($columns === null) { |
| 1390 | - $columns = [ 'source' ]; |
|
| 1390 | + $columns = ['source']; |
|
| 1391 | 1391 | $languages = $this->languages(); |
| 1392 | 1392 | foreach ($languages as $lang) { |
| 1393 | 1393 | $columns[] = $lang; |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | $lang = $this->parseLanguageIdent($lang); |
| 301 | 301 | $val = $this->val($lang); |
| 302 | 302 | if (empty($val)) { |
| 303 | - $available = array_diff_key($this->val, array_flip([ $lang, $this->defaultLanguage() ])); |
|
| 303 | + $available = array_diff_key($this->val, array_flip([$lang, $this->defaultLanguage()])); |
|
| 304 | 304 | foreach ($available as $code => $l10n) { |
| 305 | 305 | if (!empty($l10n)) { |
| 306 | 306 | return $l10n; |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | public function translations(array $langs = []) |
| 336 | 336 | { |
| 337 | 337 | if (count($langs)) { |
| 338 | - array_walk($langs, function (&$val, $key) { |
|
| 338 | + array_walk($langs, function(&$val, $key) { |
|
| 339 | 339 | $val = self::resolveLanguageIdent($val); |
| 340 | 340 | }); |
| 341 | 341 | |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | if (is_array($var)) { |
| 598 | 598 | return !!array_filter( |
| 599 | 599 | $var, |
| 600 | - function ($v, $k) { |
|
| 600 | + function($v, $k) { |
|
| 601 | 601 | if (is_string($k) && is_string($v)) { |
| 602 | 602 | if (strlen($k) && mb_strlen($v)) { |
| 603 | 603 | return true; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | public function languages(array $langs = []) |
| 96 | 96 | { |
| 97 | 97 | if (count($langs)) { |
| 98 | - array_walk($langs, function (&$val, $key) { |
|
| 98 | + array_walk($langs, function(&$val, $key) { |
|
| 99 | 99 | $val = self::resolveLanguageIdent($val); |
| 100 | 100 | }); |
| 101 | 101 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $available = array_keys($this->languages); |
| 119 | 119 | |
| 120 | 120 | if (count($langs)) { |
| 121 | - array_walk($langs, function (&$val, $key) { |
|
| 121 | + array_walk($langs, function(&$val, $key) { |
|
| 122 | 122 | $val = self::resolveLanguageIdent($val); |
| 123 | 123 | }); |
| 124 | 124 | |