@@ -77,7 +77,7 @@ |
||
77 | 77 | $container = new Container(); |
78 | 78 | $container->bind(TranslatorConfig::class, new TranslatorConfig([ |
79 | 79 | 'locale' => 'en', |
80 | - 'directory' => __DIR__ . '/fixtures/locales/', |
|
80 | + 'directory' => __DIR__.'/fixtures/locales/', |
|
81 | 81 | 'loaders' => [ |
82 | 82 | 'php' => PhpFileLoader::class, |
83 | 83 | 'po' => PoFileLoader::class, |
@@ -44,7 +44,7 @@ |
||
44 | 44 | |
45 | 45 | $this->container->bind(TranslatorConfig::class, new TranslatorConfig([ |
46 | 46 | 'locale' => 'en', |
47 | - 'directory' => __DIR__ . '/fixtures/locales/', |
|
47 | + 'directory' => __DIR__.'/fixtures/locales/', |
|
48 | 48 | 'loaders' => [ |
49 | 49 | 'php' => PhpFileLoader::class, |
50 | 50 | 'po' => PoFileLoader::class, |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public function testHasLocale(): void |
26 | 26 | { |
27 | 27 | $loader = new CatalogueLoader(new TranslatorConfig([ |
28 | - 'directory' => __DIR__ . '/fixtures/locales/', |
|
28 | + 'directory' => __DIR__.'/fixtures/locales/', |
|
29 | 29 | ])); |
30 | 30 | |
31 | 31 | $this->assertTrue($loader->hasLocale('ru')); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public function testGetLocales(): void |
36 | 36 | { |
37 | 37 | $loader = new CatalogueLoader(new TranslatorConfig([ |
38 | - 'directory' => __DIR__ . '/fixtures/locales/', |
|
38 | + 'directory' => __DIR__.'/fixtures/locales/', |
|
39 | 39 | ])); |
40 | 40 | |
41 | 41 | $compared = $loader->getLocales(); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function testLoadCatalogue(): void |
50 | 50 | { |
51 | 51 | $loader = new CatalogueLoader(new TranslatorConfig([ |
52 | - 'directory' => __DIR__ . '/fixtures/locales/', |
|
52 | + 'directory' => __DIR__.'/fixtures/locales/', |
|
53 | 53 | 'loaders' => [ |
54 | 54 | 'php' => PhpFileLoader::class, |
55 | 55 | 'po' => PoFileLoader::class, |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | public function testLoadCatalogueNoLoader(): void |
90 | 90 | { |
91 | 91 | $loader = new CatalogueLoader(new TranslatorConfig([ |
92 | - 'directory' => __DIR__ . '/fixtures/locales/', |
|
92 | + 'directory' => __DIR__.'/fixtures/locales/', |
|
93 | 93 | 'loaders' => [ |
94 | 94 | 'php' => PhpFileLoader::class, |
95 | 95 | ], |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $cache->shouldReceive('setLocales')->andReturn(null); |
32 | 32 | |
33 | 33 | $manager = new CatalogueManager(new CatalogueLoader(new TranslatorConfig([ |
34 | - 'directory' => __DIR__ . '/fixtures/locales/', |
|
34 | + 'directory' => __DIR__.'/fixtures/locales/', |
|
35 | 35 | 'loaders' => [ |
36 | 36 | 'php' => PhpFileLoader::class, |
37 | 37 | 'po' => PoFileLoader::class, |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $cache->shouldNotReceive('setLocales')->andReturn(null); |
50 | 50 | |
51 | 51 | $manager = new CatalogueManager(new CatalogueLoader(new TranslatorConfig([ |
52 | - 'directory' => __DIR__ . '/fixtures/locales/', |
|
52 | + 'directory' => __DIR__.'/fixtures/locales/', |
|
53 | 53 | 'loaders' => [ |
54 | 54 | 'php' => PhpFileLoader::class, |
55 | 55 | 'po' => PoFileLoader::class, |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $cache->shouldReceive('getLocales')->andReturn(['en', 'ru']); |
67 | 67 | |
68 | 68 | $manager = new CatalogueManager(new CatalogueLoader(new TranslatorConfig([ |
69 | - 'directory' => __DIR__ . '/fixtures/locales/', |
|
69 | + 'directory' => __DIR__.'/fixtures/locales/', |
|
70 | 70 | 'loaders' => [ |
71 | 71 | 'php' => PhpFileLoader::class, |
72 | 72 | 'po' => PoFileLoader::class, |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | ]); |
130 | 130 | |
131 | 131 | $manager = new CatalogueManager(new CatalogueLoader(new TranslatorConfig([ |
132 | - 'directory' => __DIR__ . '/fixtures/locales/', |
|
132 | + 'directory' => __DIR__.'/fixtures/locales/', |
|
133 | 133 | 'loaders' => [ |
134 | 134 | 'php' => PhpFileLoader::class, |
135 | 135 | 'po' => PoFileLoader::class, |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function getMessage(string $field, $value): string |
75 | 75 | { |
76 | - if (!empty($this->message)) { |
|
76 | + if (!empty($this->message)){ |
|
77 | 77 | return Translator::interpolate( |
78 | 78 | $this->message, |
79 | 79 | array_merge([$value, $field], $this->args) |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | $name = $this->check; |
84 | - if (is_array($name) && isset($name[0], $name[1])) { |
|
84 | + if (is_array($name) && isset($name[0], $name[1])){ |
|
85 | 85 | $name = sprintf( |
86 | 86 | '%s::%s', |
87 | 87 | is_object($name[0]) ? get_class($name[0]) : $name, |
88 | 88 | $name[1] |
89 | 89 | ); |
90 | - } elseif (!is_string($name)) { |
|
90 | + } elseif (!is_string($name)){ |
|
91 | 91 | $name = '~user-defined~'; |
92 | 92 | } |
93 | 93 |
@@ -73,7 +73,8 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function getMessage(string $field, $value): string |
75 | 75 | { |
76 | - if (!empty($this->message)) { |
|
76 | + if (!empty($this->message)) |
|
77 | + { |
|
77 | 78 | return Translator::interpolate( |
78 | 79 | $this->message, |
79 | 80 | array_merge([$value, $field], $this->args) |
@@ -81,13 +82,16 @@ discard block |
||
81 | 82 | } |
82 | 83 | |
83 | 84 | $name = $this->check; |
84 | - if (is_array($name) && isset($name[0], $name[1])) { |
|
85 | + if (is_array($name) && isset($name[0], $name[1])) |
|
86 | + { |
|
85 | 87 | $name = sprintf( |
86 | 88 | '%s::%s', |
87 | 89 | is_object($name[0]) ? get_class($name[0]) : $name, |
88 | 90 | $name[1] |
89 | 91 | ); |
90 | - } elseif (!is_string($name)) { |
|
92 | + } |
|
93 | + elseif (!is_string($name)) |
|
94 | + { |
|
91 | 95 | $name = '~user-defined~'; |
92 | 96 | } |
93 | 97 |
@@ -69,11 +69,11 @@ |
||
69 | 69 | */ |
70 | 70 | public function datetime($value): bool |
71 | 71 | { |
72 | - if (!is_scalar($value)) { |
|
72 | + if (!is_scalar($value)){ |
|
73 | 73 | return false; |
74 | 74 | } |
75 | 75 | |
76 | - if (is_numeric($value)) { |
|
76 | + if (is_numeric($value)){ |
|
77 | 77 | return true; |
78 | 78 | } |
79 | 79 |
@@ -69,11 +69,13 @@ |
||
69 | 69 | */ |
70 | 70 | public function datetime($value): bool |
71 | 71 | { |
72 | - if (!is_scalar($value)) { |
|
72 | + if (!is_scalar($value)) |
|
73 | + { |
|
73 | 74 | return false; |
74 | 75 | } |
75 | 76 | |
76 | - if (is_numeric($value)) { |
|
77 | + if (is_numeric($value)) |
|
78 | + { |
|
77 | 79 | return true; |
78 | 80 | } |
79 | 81 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function size($file, int $size): bool |
80 | 80 | { |
81 | - if (empty($filename = $this->resolveFilename($file))) { |
|
81 | + if (empty($filename = $this->resolveFilename($file))){ |
|
82 | 82 | return false; |
83 | 83 | } |
84 | 84 | |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function extension($file, $extensions): bool |
98 | 98 | { |
99 | - if (!is_array($extensions)) { |
|
99 | + if (!is_array($extensions)){ |
|
100 | 100 | $extensions = array_slice(func_get_args(), 1); |
101 | 101 | } |
102 | 102 | |
103 | - if ($file instanceof UploadedFileInterface) { |
|
103 | + if ($file instanceof UploadedFileInterface){ |
|
104 | 104 | return in_array( |
105 | 105 | $this->files->extension($file->getClientFilename()), |
106 | 106 | $extensions, |
@@ -78,7 +78,8 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function size($file, int $size): bool |
80 | 80 | { |
81 | - if (empty($filename = $this->resolveFilename($file))) { |
|
81 | + if (empty($filename = $this->resolveFilename($file))) |
|
82 | + { |
|
82 | 83 | return false; |
83 | 84 | } |
84 | 85 | |
@@ -96,11 +97,13 @@ discard block |
||
96 | 97 | */ |
97 | 98 | public function extension($file, $extensions): bool |
98 | 99 | { |
99 | - if (!is_array($extensions)) { |
|
100 | + if (!is_array($extensions)) |
|
101 | + { |
|
100 | 102 | $extensions = array_slice(func_get_args(), 1); |
101 | 103 | } |
102 | 104 | |
103 | - if ($file instanceof UploadedFileInterface) { |
|
105 | + if ($file instanceof UploadedFileInterface) |
|
106 | + { |
|
104 | 107 | return in_array( |
105 | 108 | $this->files->extension($file->getClientFilename()), |
106 | 109 | $extensions, |
@@ -90,15 +90,15 @@ discard block |
||
90 | 90 | public function type($file, $types): bool |
91 | 91 | { |
92 | 92 | $image = $this->imageData($file); |
93 | - if ($image === false) { |
|
93 | + if ($image === false){ |
|
94 | 94 | return false; |
95 | 95 | } |
96 | 96 | |
97 | - if (!is_array($types)) { |
|
97 | + if (!is_array($types)){ |
|
98 | 98 | $types = array_slice(func_get_args(), 1); |
99 | 99 | } |
100 | 100 | |
101 | - if (!isset(self::IMAGE_TYPES[$image[self::IMAGE_TYPE]])) { |
|
101 | + if (!isset(self::IMAGE_TYPES[$image[self::IMAGE_TYPE]])){ |
|
102 | 102 | return false; |
103 | 103 | } |
104 | 104 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function smaller($file, int $width, int $height): bool |
128 | 128 | { |
129 | - if (empty($image = $this->imageData($file))) { |
|
129 | + if (empty($image = $this->imageData($file))){ |
|
130 | 130 | return false; |
131 | 131 | } |
132 | 132 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function bigger($file, int $width, int $height = null): bool |
146 | 146 | { |
147 | - if (empty($image = $this->imageData($file))) { |
|
147 | + if (empty($image = $this->imageData($file))){ |
|
148 | 148 | return false; |
149 | 149 | } |
150 | 150 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | protected function imageData($file) |
163 | 163 | { |
164 | 164 | $filename = $this->resolveFilename($file); |
165 | - if (empty($filename)) { |
|
165 | + if (empty($filename)){ |
|
166 | 166 | return false; |
167 | 167 | } |
168 | 168 |
@@ -90,15 +90,18 @@ discard block |
||
90 | 90 | public function type($file, $types): bool |
91 | 91 | { |
92 | 92 | $image = $this->imageData($file); |
93 | - if ($image === false) { |
|
93 | + if ($image === false) |
|
94 | + { |
|
94 | 95 | return false; |
95 | 96 | } |
96 | 97 | |
97 | - if (!is_array($types)) { |
|
98 | + if (!is_array($types)) |
|
99 | + { |
|
98 | 100 | $types = array_slice(func_get_args(), 1); |
99 | 101 | } |
100 | 102 | |
101 | - if (!isset(self::IMAGE_TYPES[$image[self::IMAGE_TYPE]])) { |
|
103 | + if (!isset(self::IMAGE_TYPES[$image[self::IMAGE_TYPE]])) |
|
104 | + { |
|
102 | 105 | return false; |
103 | 106 | } |
104 | 107 | |
@@ -126,7 +129,8 @@ discard block |
||
126 | 129 | */ |
127 | 130 | public function smaller($file, int $width, int $height): bool |
128 | 131 | { |
129 | - if (empty($image = $this->imageData($file))) { |
|
132 | + if (empty($image = $this->imageData($file))) |
|
133 | + { |
|
130 | 134 | return false; |
131 | 135 | } |
132 | 136 | |
@@ -144,7 +148,8 @@ discard block |
||
144 | 148 | */ |
145 | 149 | public function bigger($file, int $width, int $height = null): bool |
146 | 150 | { |
147 | - if (empty($image = $this->imageData($file))) { |
|
151 | + if (empty($image = $this->imageData($file))) |
|
152 | + { |
|
148 | 153 | return false; |
149 | 154 | } |
150 | 155 | |
@@ -162,7 +167,8 @@ discard block |
||
162 | 167 | protected function imageData($file) |
163 | 168 | { |
164 | 169 | $filename = $this->resolveFilename($file); |
165 | - if (empty($filename)) { |
|
170 | + if (empty($filename)) |
|
171 | + { |
|
166 | 172 | return false; |
167 | 173 | } |
168 | 174 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function notEmpty($value, bool $asString = true): bool |
27 | 27 | { |
28 | - if ($asString && is_string($value) && trim($value) === '') { |
|
28 | + if ($asString && is_string($value) && trim($value) === ''){ |
|
29 | 29 | return false; |
30 | 30 | } |
31 | 31 |
@@ -25,7 +25,8 @@ |
||
25 | 25 | */ |
26 | 26 | public function notEmpty($value, bool $asString = true): bool |
27 | 27 | { |
28 | - if ($asString && is_string($value) && trim($value) === '') { |
|
28 | + if ($asString && is_string($value) && trim($value) === '') |
|
29 | + { |
|
29 | 30 | return false; |
30 | 31 | } |
31 | 32 |