@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * |
406 | 406 | * @param string $className The class name of the object catalog model. |
407 | 407 | * @throws InvalidArgumentException If the class name is not a string. |
408 | - * @return AbstractPropertyDisplay Chainable |
|
408 | + * @return ResourceRepository Chainable |
|
409 | 409 | */ |
410 | 410 | public function setCatalogClass($className) |
411 | 411 | { |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | * |
459 | 459 | * @param string $className The class name of the object resource model. |
460 | 460 | * @throws InvalidArgumentException If the class name is not a string. |
461 | - * @return AbstractPropertyDisplay Chainable |
|
461 | + * @return ResourceRepository Chainable |
|
462 | 462 | */ |
463 | 463 | public function setResourceClass($className) |
464 | 464 | { |
@@ -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( |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | /** |
854 | 854 | * Retrieve the default included paths to scan for translatable text. |
855 | 855 | * |
856 | - * @return array |
|
856 | + * @return string[] |
|
857 | 857 | */ |
858 | 858 | public function defaultIncludedPaths() |
859 | 859 | { |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | /** |
965 | 965 | * Retrieve the supported output formats for the translations file. |
966 | 966 | * |
967 | - * @return array |
|
967 | + * @return string[] |
|
968 | 968 | */ |
969 | 969 | public function outputFormats() |
970 | 970 | { |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | /** |
1168 | 1168 | * Retrieve the language of the source code. |
1169 | 1169 | * |
1170 | - * @return array|null |
|
1170 | + * @return string|null |
|
1171 | 1171 | */ |
1172 | 1172 | public function sourceLanguage() |
1173 | 1173 | { |
@@ -674,7 +674,7 @@ |
||
674 | 674 | 'longPrefix' => 'max-depth', |
675 | 675 | 'castTo' => 'int', |
676 | 676 | 'description' => 'Descend at most the given number of levels of directories. '. |
677 | - 'A negative value means no limit.', |
|
677 | + 'A negative value means no limit.', |
|
678 | 678 | 'defaultValue' => static::DEFAULT_MAX_DEPTH, |
679 | 679 | 'prompt' => 'Scan Depth (of directories)', |
680 | 680 | 'acceptValue' => function ($response) { |
@@ -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 | /** |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | fputcsv($file, $this->csvHeaderRow()); |
1304 | 1304 | |
1305 | 1305 | foreach ($messages as $id => $entry) { |
1306 | - $row = [ $id ]; |
|
1306 | + $row = [$id]; |
|
1307 | 1307 | foreach ($languages as $lang) { |
1308 | 1308 | if (isset($entry['translations'][$lang])) { |
1309 | 1309 | $row[] = $entry['translations'][$lang]; |
@@ -1382,7 +1382,7 @@ discard block |
||
1382 | 1382 | static $columns; |
1383 | 1383 | |
1384 | 1384 | if ($columns === null) { |
1385 | - $columns = [ 'source' ]; |
|
1385 | + $columns = ['source']; |
|
1386 | 1386 | $languages = $this->languages(); |
1387 | 1387 | foreach ($languages as $lang) { |
1388 | 1388 | $columns[] = $lang; |
@@ -126,9 +126,9 @@ |
||
126 | 126 | $i++; |
127 | 127 | |
128 | 128 | if ($i == 1) { |
129 | - $source = $data[0]; |
|
129 | + $source = $data[0]; |
|
130 | 130 | $count = count($data); |
131 | - $context = $data[( $count-1 )]; |
|
131 | + $context = $data[($count - 1)]; |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Remove "ident" and "context" columns. |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | protected function processMultiplePaths($paths) |
38 | 38 | { |
39 | 39 | $paths = $this->asArray($paths); |
40 | - $paths = array_map([ $this, 'filterPath' ], $paths); |
|
41 | - $paths = array_filter($paths, [ $this, 'pathExists' ]); |
|
40 | + $paths = array_map([$this, 'filterPath'], $paths); |
|
41 | + $paths = array_filter($paths, [$this, 'pathExists']); |
|
42 | 42 | |
43 | 43 | if ($paths === false) { |
44 | 44 | throw new InvalidArgumentException('Received invalid paths.'); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | $depth = 1; |
141 | 141 | $files = glob($pattern, $flags); |
142 | - foreach (glob(dirname($pattern).'/*', (GLOB_ONLYDIR|GLOB_NOSORT)) as $dir) { |
|
142 | + foreach (glob(dirname($pattern).'/*', (GLOB_ONLYDIR | GLOB_NOSORT)) as $dir) { |
|
143 | 143 | $files = array_merge($files, $this->globRecursive($dir.'/'.basename($pattern), $flags)); |
144 | 144 | $depth++; |
145 | 145 | if ($depth >= $maxDepth) { |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | foreach ($params as $key => $param) { |
222 | 222 | $setter = $this->setter($key); |
223 | 223 | |
224 | - if (!is_callable([ $this, $setter ])) { |
|
224 | + if (!is_callable([$this, $setter])) { |
|
225 | 225 | continue; |
226 | 226 | } |
227 | 227 |