@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Translation; |
4 | 4 | |
5 | -use RuntimeException; |
|
6 | -use Illuminate\Filesystem\Filesystem; |
|
7 | 5 | use Illuminate\Contracts\Translation\Loader; |
6 | +use Illuminate\Filesystem\Filesystem; |
|
7 | +use RuntimeException; |
|
8 | 8 | |
9 | 9 | class FileLoader implements Loader |
10 | 10 | { |
@@ -137,7 +137,7 @@ |
||
137 | 137 | protected function loadJsonPaths($locale) |
138 | 138 | { |
139 | 139 | return collect(array_merge($this->jsonPaths, [$this->path])) |
140 | - ->reduce(function ($output, $path) use ($locale) { |
|
140 | + ->reduce(function($output, $path) use ($locale) { |
|
141 | 141 | if ($this->files->exists($full = "{$path}/{$locale}.json")) { |
142 | 142 | $decoded = json_decode($this->files->get($full), true); |
143 | 143 |
@@ -137,7 +137,7 @@ |
||
137 | 137 | protected function loadJsonPaths($locale) |
138 | 138 | { |
139 | 139 | return collect(array_merge($this->jsonPaths, [$this->path])) |
140 | - ->reduce(function ($output, $path) use ($locale) { |
|
140 | + ->reduce(function ($output, $path) use ($locale){ |
|
141 | 141 | if ($this->files->exists($full = "{$path}/{$locale}.json")) { |
142 | 142 | $decoded = json_decode($this->files->get($full), true); |
143 | 143 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @param string $line |
13 | 13 | * @param int $number |
14 | 14 | * @param string $locale |
15 | - * @return mixed |
|
15 | + * @return string |
|
16 | 16 | */ |
17 | 17 | public function choose($line, $number, $locale) |
18 | 18 | { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @param array $segments |
40 | 40 | * @param int $number |
41 | - * @return mixed |
|
41 | + * @return string|null |
|
42 | 42 | */ |
43 | 43 | private function extract($segments, $number) |
44 | 44 | { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @param string $part |
56 | 56 | * @param int $number |
57 | - * @return mixed |
|
57 | + * @return null|string |
|
58 | 58 | */ |
59 | 59 | private function extractFromString($part, $number) |
60 | 60 | { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | $pluralIndex = $this->getPluralIndex($locale, $number); |
28 | 28 | |
29 | - if (count($segments) == 1 || ! isset($segments[$pluralIndex])) { |
|
29 | + if (count($segments) == 1 || !isset($segments[$pluralIndex])) { |
|
30 | 30 | return $segments[0]; |
31 | 31 | } |
32 | 32 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | private function extract($segments, $number) |
44 | 44 | { |
45 | 45 | foreach ($segments as $part) { |
46 | - if (! is_null($line = $this->extractFromString($part, $number))) { |
|
46 | + if (!is_null($line = $this->extractFromString($part, $number))) { |
|
47 | 47 | return $line; |
48 | 48 | } |
49 | 49 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | private function stripConditions($segments) |
93 | 93 | { |
94 | - return collect($segments)->map(function ($part) { |
|
94 | + return collect($segments)->map(function($part){ |
|
95 | 95 | return preg_replace('/^[\{\[]([^\[\]\{\}]*)[\}\]]/', '', $part); |
96 | 96 | })->all(); |
97 | 97 | } |
@@ -91,7 +91,7 @@ |
||
91 | 91 | */ |
92 | 92 | private function stripConditions($segments) |
93 | 93 | { |
94 | - return collect($segments)->map(function ($part) { |
|
94 | + return collect($segments)->map(function ($part){ |
|
95 | 95 | return preg_replace('/^[\{\[]([^\[\]\{\}]*)[\}\]]/', '', $part); |
96 | 96 | })->all(); |
97 | 97 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | /** |
54 | 54 | * Get the services provided by the provider. |
55 | 55 | * |
56 | - * @return array |
|
56 | + * @return string[] |
|
57 | 57 | */ |
58 | 58 | public function provides() |
59 | 59 | { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | $this->registerLoader(); |
24 | 24 | |
25 | - $this->app->singleton('translator', function ($app) { |
|
25 | + $this->app->singleton('translator', function($app){ |
|
26 | 26 | $loader = $app['translation.loader']; |
27 | 27 | |
28 | 28 | // When registering the translator component, we'll need to set the default |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected function registerLoader() |
47 | 47 | { |
48 | - $this->app->singleton('translation.loader', function ($app) { |
|
48 | + $this->app->singleton('translation.loader', function($app){ |
|
49 | 49 | return new FileLoader($app['files'], $app['path.lang']); |
50 | 50 | }); |
51 | 51 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | $this->registerLoader(); |
24 | 24 | |
25 | - $this->app->singleton('translator', function ($app) { |
|
25 | + $this->app->singleton('translator', function ($app){ |
|
26 | 26 | $loader = $app['translation.loader']; |
27 | 27 | |
28 | 28 | // When registering the translator component, we'll need to set the default |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected function registerLoader() |
47 | 47 | { |
48 | - $this->app->singleton('translation.loader', function ($app) { |
|
48 | + $this->app->singleton('translation.loader', function ($app){ |
|
49 | 49 | return new FileLoader($app['files'], $app['path.lang']); |
50 | 50 | }); |
51 | 51 | } |
@@ -3,13 +3,13 @@ |
||
3 | 3 | namespace Illuminate\Translation; |
4 | 4 | |
5 | 5 | use Countable; |
6 | +use Illuminate\Contracts\Translation\Loader; |
|
7 | +use Illuminate\Contracts\Translation\Translator as TranslatorContract; |
|
6 | 8 | use Illuminate\Support\Arr; |
7 | -use Illuminate\Support\Str; |
|
8 | 9 | use Illuminate\Support\Collection; |
9 | -use Illuminate\Support\Traits\Macroable; |
|
10 | -use Illuminate\Contracts\Translation\Loader; |
|
11 | 10 | use Illuminate\Support\NamespacedItemResolver; |
12 | -use Illuminate\Contracts\Translation\Translator as TranslatorContract; |
|
11 | +use Illuminate\Support\Str; |
|
12 | +use Illuminate\Support\Traits\Macroable; |
|
13 | 13 | |
14 | 14 | class Translator extends NamespacedItemResolver implements TranslatorContract |
15 | 15 | { |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | : [$locale ?: $this->locale]; |
122 | 122 | |
123 | 123 | foreach ($locales as $locale) { |
124 | - if (! is_null($line = $this->getLine( |
|
124 | + if (!is_null($line = $this->getLine( |
|
125 | 125 | $namespace, $group, $locale, $item, $replace |
126 | 126 | ))) { |
127 | 127 | break; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | // If we can't find a translation for the JSON key, we will attempt to translate it |
161 | 161 | // using the typical translation file. This way developers can always just use a |
162 | 162 | // helper such as __ instead of having to pick between trans or __ with views. |
163 | - if (! isset($line)) { |
|
163 | + if (!isset($line)) { |
|
164 | 164 | $fallback = $this->get($key, $replace, $locale); |
165 | 165 | |
166 | 166 | if ($fallback !== $key) { |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | */ |
283 | 283 | protected function sortReplacements(array $replace) |
284 | 284 | { |
285 | - return (new Collection($replace))->sortBy(function ($value, $key) { |
|
285 | + return (new Collection($replace))->sortBy(function($value, $key){ |
|
286 | 286 | return mb_strlen($key) * -1; |
287 | 287 | })->all(); |
288 | 288 | } |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | */ |
398 | 398 | public function getSelector() |
399 | 399 | { |
400 | - if (! isset($this->selector)) { |
|
400 | + if (!isset($this->selector)) { |
|
401 | 401 | $this->selector = new MessageSelector; |
402 | 402 | } |
403 | 403 |
@@ -282,7 +282,7 @@ |
||
282 | 282 | */ |
283 | 283 | protected function sortReplacements(array $replace) |
284 | 284 | { |
285 | - return (new Collection($replace))->sortBy(function ($value, $key) { |
|
285 | + return (new Collection($replace))->sortBy(function ($value, $key){ |
|
286 | 286 | return mb_strlen($key) * -1; |
287 | 287 | })->all(); |
288 | 288 | } |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\View\Compilers; |
4 | 4 | |
5 | -use InvalidArgumentException; |
|
6 | 5 | use Illuminate\Filesystem\Filesystem; |
6 | +use InvalidArgumentException; |
|
7 | 7 | |
8 | 8 | abstract class Compiler |
9 | 9 | { |
@@ -69,6 +69,6 @@ |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | return $this->files->lastModified($path) >= |
72 | - $this->files->lastModified($compiled); |
|
72 | + $this->files->lastModified($compiled); |
|
73 | 73 | } |
74 | 74 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function __construct(Filesystem $files, $cachePath) |
34 | 34 | { |
35 | - if (! $cachePath) { |
|
35 | + if (!$cachePath) { |
|
36 | 36 | throw new InvalidArgumentException('Please provide a valid cache path.'); |
37 | 37 | } |
38 | 38 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | // If the compiled file doesn't exist we will indicate that the view is expired |
65 | 65 | // so that it can be re-compiled. Else, we will verify the last modification |
66 | 66 | // of the views is less than the modification times of the compiled views. |
67 | - if (! $this->files->exists($compiled)) { |
|
67 | + if (!$this->files->exists($compiled)) { |
|
68 | 68 | return true; |
69 | 69 | } |
70 | 70 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | /** |
23 | 23 | * Get the echo methods in the proper order for compilation. |
24 | 24 | * |
25 | - * @return array |
|
25 | + * @return string[] |
|
26 | 26 | */ |
27 | 27 | protected function getEchoMethods() |
28 | 28 | { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->rawTags[0], $this->rawTags[1]); |
45 | 45 | |
46 | - $callback = function ($matches) { |
|
46 | + $callback = function($matches){ |
|
47 | 47 | $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; |
48 | 48 | |
49 | 49 | return $matches[1] ? substr($matches[0], 1) : "<?php echo {$this->compileEchoDefaults($matches[2])}; ?>{$whitespace}"; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->contentTags[0], $this->contentTags[1]); |
64 | 64 | |
65 | - $callback = function ($matches) { |
|
65 | + $callback = function($matches){ |
|
66 | 66 | $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; |
67 | 67 | |
68 | 68 | $wrapped = sprintf($this->echoFormat, $this->compileEchoDefaults($matches[2])); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | { |
84 | 84 | $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->escapedTags[0], $this->escapedTags[1]); |
85 | 85 | |
86 | - $callback = function ($matches) { |
|
86 | + $callback = function($matches){ |
|
87 | 87 | $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; |
88 | 88 | |
89 | 89 | return $matches[1] ? $matches[0] : "<?php echo e({$this->compileEchoDefaults($matches[2])}); ?>{$whitespace}"; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->rawTags[0], $this->rawTags[1]); |
45 | 45 | |
46 | - $callback = function ($matches) { |
|
46 | + $callback = function ($matches){ |
|
47 | 47 | $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; |
48 | 48 | |
49 | 49 | return $matches[1] ? substr($matches[0], 1) : "<?php echo {$this->compileEchoDefaults($matches[2])}; ?>{$whitespace}"; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->contentTags[0], $this->contentTags[1]); |
64 | 64 | |
65 | - $callback = function ($matches) { |
|
65 | + $callback = function ($matches){ |
|
66 | 66 | $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; |
67 | 67 | |
68 | 68 | $wrapped = sprintf($this->echoFormat, $this->compileEchoDefaults($matches[2])); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | { |
84 | 84 | $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->escapedTags[0], $this->escapedTags[1]); |
85 | 85 | |
86 | - $callback = function ($matches) { |
|
86 | + $callback = function ($matches){ |
|
87 | 87 | $whitespace = empty($matches[3]) ? '' : $matches[3].$matches[3]; |
88 | 88 | |
89 | 89 | return $matches[1] ? $matches[0] : "<?php echo e({$this->compileEchoDefaults($matches[2])}); ?>{$whitespace}"; |
@@ -3,8 +3,8 @@ |
||
3 | 3 | namespace Illuminate\View\Concerns; |
4 | 4 | |
5 | 5 | use Closure; |
6 | -use Illuminate\Support\Str; |
|
7 | 6 | use Illuminate\Contracts\View\View as ViewContract; |
7 | +use Illuminate\Support\Str; |
|
8 | 8 | |
9 | 9 | trait ManagesEvents |
10 | 10 | { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | // Once we have the class and method name, we can build the Closure to resolve |
121 | 121 | // the instance out of the IoC container and call the method on it with the |
122 | 122 | // given arguments that are passed to the Closure as the composer's data. |
123 | - return function () use ($class, $method) { |
|
123 | + return function() use ($class, $method) { |
|
124 | 124 | return call_user_func_array( |
125 | 125 | [$this->container->make($class), $method], func_get_args() |
126 | 126 | ); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | protected function addEventListener($name, $callback) |
161 | 161 | { |
162 | 162 | if (Str::contains($name, '*')) { |
163 | - $callback = function ($name, array $data) use ($callback) { |
|
163 | + $callback = function($name, array $data) use ($callback) { |
|
164 | 164 | return $callback($data[0]); |
165 | 165 | }; |
166 | 166 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | // Once we have the class and method name, we can build the Closure to resolve |
121 | 121 | // the instance out of the IoC container and call the method on it with the |
122 | 122 | // given arguments that are passed to the Closure as the composer's data. |
123 | - return function () use ($class, $method) { |
|
123 | + return function () use ($class, $method){ |
|
124 | 124 | return call_user_func_array( |
125 | 125 | [$this->container->make($class), $method], func_get_args() |
126 | 126 | ); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | protected function addEventListener($name, $callback) |
161 | 161 | { |
162 | 162 | if (Str::contains($name, '*')) { |
163 | - $callback = function ($name, array $data) use ($callback) { |
|
163 | + $callback = function ($name, array $data) use ($callback){ |
|
164 | 164 | return $callback($data[0]); |
165 | 165 | }; |
166 | 166 | } |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\View\Concerns; |
4 | 4 | |
5 | -use InvalidArgumentException; |
|
6 | 5 | use Illuminate\Contracts\View\View; |
6 | +use InvalidArgumentException; |
|
7 | 7 | |
8 | 8 | trait ManagesLayouts |
9 | 9 | { |
@@ -165,7 +165,7 @@ |
||
165 | 165 | */ |
166 | 166 | public static function parentPlaceholder($section = '') |
167 | 167 | { |
168 | - if (! isset(static::$parentPlaceholder[$section])) { |
|
168 | + if (!isset(static::$parentPlaceholder[$section])) { |
|
169 | 169 | static::$parentPlaceholder[$section] = '##parent-placeholder-'.sha1($section).'##'; |
170 | 170 | } |
171 | 171 |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\View\Engines; |
4 | 4 | |
5 | -use Exception; |
|
6 | 5 | use ErrorException; |
6 | +use Exception; |
|
7 | 7 | use Illuminate\View\Compilers\CompilerInterface; |
8 | 8 | |
9 | 9 | class CompilerEngine extends PhpEngine |