@@ -31,7 +31,7 @@ |
||
31 | 31 | { |
32 | 32 | $resolver = $this->getResolver(); |
33 | 33 | |
34 | - if ($resolver === null) { |
|
34 | + if ($resolver === null){ |
|
35 | 35 | throw new \LogicException('Can not generate public url: File not accessible by HTTP'); |
36 | 36 | } |
37 | 37 |
@@ -31,7 +31,8 @@ |
||
31 | 31 | { |
32 | 32 | $resolver = $this->getResolver(); |
33 | 33 | |
34 | - if ($resolver === null) { |
|
34 | + if ($resolver === null) |
|
35 | + { |
|
35 | 36 | throw new \LogicException('Can not generate public url: File not accessible by HTTP'); |
36 | 37 | } |
37 | 38 |
@@ -63,20 +63,26 @@ |
||
63 | 63 | ); |
64 | 64 | |
65 | 65 | /** @var \SplFileInfo $file */ |
66 | - foreach($iterator as $file) { |
|
67 | - if ($file->getFilename() === '.gitignore') { |
|
66 | + foreach($iterator as $file) |
|
67 | + { |
|
68 | + if ($file->getFilename() === '.gitignore') |
|
69 | + { |
|
68 | 70 | continue; |
69 | 71 | } |
70 | 72 | |
71 | 73 | \error_clear_last(); |
72 | 74 | |
73 | - if ($file->isDir()) { |
|
75 | + if ($file->isDir()) |
|
76 | + { |
|
74 | 77 | @\rmdir($file->getPathname()); |
75 | - } else { |
|
78 | + } |
|
79 | + else |
|
80 | + { |
|
76 | 81 | @\unlink($file->getPathname()); |
77 | 82 | } |
78 | 83 | |
79 | - if ($error = \error_get_last()) { |
|
84 | + if ($error = \error_get_last()) |
|
85 | + { |
|
80 | 86 | $prefix = 'An error occurred while clear temporary local storage directory: '; |
81 | 87 | $this->addWarning($prefix . $error['message']); |
82 | 88 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * @var string |
16 | 16 | */ |
17 | - protected const LOCAL_STORAGE_DIRECTORY = __DIR__ . '/storage'; |
|
17 | + protected const LOCAL_STORAGE_DIRECTORY = __DIR__.'/storage'; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @var BucketInterface |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | ); |
39 | 39 | |
40 | 40 | $this->second = Bucket::fromAdapter( |
41 | - new LocalFilesystemAdapter(self::LOCAL_STORAGE_DIRECTORY . '/second') |
|
41 | + new LocalFilesystemAdapter(self::LOCAL_STORAGE_DIRECTORY.'/second') |
|
42 | 42 | ); |
43 | 43 | } |
44 | 44 | |
@@ -63,22 +63,22 @@ discard block |
||
63 | 63 | ); |
64 | 64 | |
65 | 65 | /** @var \SplFileInfo $file */ |
66 | - foreach($iterator as $file) { |
|
67 | - if ($file->getFilename() === '.gitignore') { |
|
66 | + foreach ($iterator as $file){ |
|
67 | + if ($file->getFilename() === '.gitignore'){ |
|
68 | 68 | continue; |
69 | 69 | } |
70 | 70 | |
71 | 71 | \error_clear_last(); |
72 | 72 | |
73 | - if ($file->isDir()) { |
|
73 | + if ($file->isDir()){ |
|
74 | 74 | @\rmdir($file->getPathname()); |
75 | - } else { |
|
75 | + }else{ |
|
76 | 76 | @\unlink($file->getPathname()); |
77 | 77 | } |
78 | 78 | |
79 | - if ($error = \error_get_last()) { |
|
79 | + if ($error = \error_get_last()){ |
|
80 | 80 | $prefix = 'An error occurred while clear temporary local storage directory: '; |
81 | - $this->addWarning($prefix . $error['message']); |
|
81 | + $this->addWarning($prefix.$error['message']); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |
@@ -151,7 +151,8 @@ |
||
151 | 151 | |
152 | 152 | $actual = ''; |
153 | 153 | $stream = $this->local->getStream('file.txt'); |
154 | - while (!\feof($stream)) { |
|
154 | + while (!\feof($stream)) |
|
155 | + { |
|
155 | 156 | $actual .= \fread($stream, 256); |
156 | 157 | } |
157 | 158 | \fclose($stream); |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | public function testVisibility(): void |
58 | 58 | { |
59 | 59 | $this->markTestSkipped( |
60 | - 'This test [' . __FUNCTION__ . '] returns incorrect visibility ' . |
|
61 | - 'of files on Windows OS. ' . |
|
60 | + 'This test ['.__FUNCTION__.'] returns incorrect visibility '. |
|
61 | + 'of files on Windows OS. '. |
|
62 | 62 | 'It is required to understand the situation' |
63 | 63 | ); |
64 | 64 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | $actual = ''; |
153 | 153 | $stream = $this->local->getStream('file.txt'); |
154 | - while (!\feof($stream)) { |
|
154 | + while (!\feof($stream)){ |
|
155 | 155 | $actual .= \fread($stream, 256); |
156 | 156 | } |
157 | 157 | \fclose($stream); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function testLastModified(): void |
177 | 177 | { |
178 | - $now = (int) \floor(\microtime(true)); |
|
178 | + $now = (int)\floor(\microtime(true)); |
|
179 | 179 | |
180 | 180 | $this->local->create('file.txt'); |
181 | 181 | $before = $this->local->getLastModified('file.txt'); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | $this->expectException(InvalidArgumentException::class); |
94 | 94 | $this->expectExceptionMessage( |
95 | - 'URI argument must be a valid URI in ' . |
|
95 | + 'URI argument must be a valid URI in '. |
|
96 | 96 | '"[STORAGE]://[PATH_TO_FILE]" format, but `test://` given' |
97 | 97 | ); |
98 | 98 | |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | public function testVisibility(): void |
158 | 158 | { |
159 | 159 | $this->markTestSkipped( |
160 | - 'This test [' . __FUNCTION__ . '] returns incorrect visibility ' . |
|
161 | - 'of files on Windows OS. ' . |
|
160 | + 'This test ['.__FUNCTION__.'] returns incorrect visibility '. |
|
161 | + 'of files on Windows OS. '. |
|
162 | 162 | 'It is required to understand the situation' |
163 | 163 | ); |
164 | 164 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | |
258 | 258 | $actual = ''; |
259 | 259 | $stream = $this->manager->getStream('file.txt'); |
260 | - while (!\feof($stream)) { |
|
260 | + while (!\feof($stream)){ |
|
261 | 261 | $actual .= \fread($stream, 256); |
262 | 262 | } |
263 | 263 | \fclose($stream); |
@@ -257,7 +257,8 @@ |
||
257 | 257 | |
258 | 258 | $actual = ''; |
259 | 259 | $stream = $this->manager->getStream('file.txt'); |
260 | - while (!\feof($stream)) { |
|
260 | + while (!\feof($stream)) |
|
261 | + { |
|
261 | 262 | $actual .= \fread($stream, 256); |
262 | 263 | } |
263 | 264 | \fclose($stream); |
@@ -190,7 +190,8 @@ |
||
190 | 190 | |
191 | 191 | $actual = ''; |
192 | 192 | $stream = $source->getStream(); |
193 | - while (!\feof($stream)) { |
|
193 | + while (!\feof($stream)) |
|
194 | + { |
|
194 | 195 | $actual .= \fread($stream, 256); |
195 | 196 | } |
196 | 197 | \fclose($stream); |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | public function testVisibility(): void |
82 | 82 | { |
83 | 83 | $this->markTestSkipped( |
84 | - 'This test [' . __FUNCTION__ . '] returns incorrect visibility ' . |
|
85 | - 'of files on Windows OS. ' . |
|
84 | + 'This test ['.__FUNCTION__.'] returns incorrect visibility '. |
|
85 | + 'of files on Windows OS. '. |
|
86 | 86 | 'It is required to understand the situation' |
87 | 87 | ); |
88 | 88 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | $actual = ''; |
192 | 192 | $stream = $source->getStream(); |
193 | - while (!\feof($stream)) { |
|
193 | + while (!\feof($stream)){ |
|
194 | 194 | $actual .= \fread($stream, 256); |
195 | 195 | } |
196 | 196 | \fclose($stream); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function testLastModified(): void |
218 | 218 | { |
219 | - $now = (int) \floor(\microtime(true)); |
|
219 | + $now = (int)\floor(\microtime(true)); |
|
220 | 220 | |
221 | 221 | $file = $this->local->file('file.txt') |
222 | 222 | ->create() |
@@ -56,13 +56,13 @@ |
||
56 | 56 | $stmt->name = $parameter->getName(); |
57 | 57 | |
58 | 58 | $type = $parameter->getType(); |
59 | - if ($type instanceof \ReflectionNamedType) { |
|
59 | + if ($type instanceof \ReflectionNamedType){ |
|
60 | 60 | $stmt->type = Type::create($type->getName()); |
61 | 61 | $stmt->builtIn = $type->isBuiltin(); |
62 | 62 | $stmt->nullable = $type->allowsNull(); |
63 | 63 | } |
64 | 64 | |
65 | - if ($parameter->isDefaultValueAvailable()) { |
|
65 | + if ($parameter->isDefaultValueAvailable()){ |
|
66 | 66 | $stmt->hasDefault = true; |
67 | 67 | $stmt->default = $parameter->getDefaultValue(); |
68 | 68 | } |
@@ -56,13 +56,15 @@ |
||
56 | 56 | $stmt->name = $parameter->getName(); |
57 | 57 | |
58 | 58 | $type = $parameter->getType(); |
59 | - if ($type instanceof \ReflectionNamedType) { |
|
59 | + if ($type instanceof \ReflectionNamedType) |
|
60 | + { |
|
60 | 61 | $stmt->type = Type::create($type->getName()); |
61 | 62 | $stmt->builtIn = $type->isBuiltin(); |
62 | 63 | $stmt->nullable = $type->allowsNull(); |
63 | 64 | } |
64 | 65 | |
65 | - if ($parameter->isDefaultValueAvailable()) { |
|
66 | + if ($parameter->isDefaultValueAvailable()) |
|
67 | + { |
|
66 | 68 | $stmt->hasDefault = true; |
67 | 69 | $stmt->default = $parameter->getDefaultValue(); |
68 | 70 | } |
@@ -13,7 +13,8 @@ discard block |
||
13 | 13 | |
14 | 14 | use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor; |
15 | 15 | |
16 | - if (!\interface_exists(NamedArgumentConstructorAnnotation::class)) { |
|
16 | + if (!\interface_exists(NamedArgumentConstructorAnnotation::class)) |
|
17 | + { |
|
17 | 18 | /** |
18 | 19 | * Marker interface for PHP7/PHP8 compatible support for named |
19 | 20 | * arguments (and constructor property promotion). |
@@ -31,7 +32,8 @@ discard block |
||
31 | 32 | |
32 | 33 | namespace Doctrine\Common\Annotations\Annotation { |
33 | 34 | |
34 | - if (!\class_exists(NamedArgumentConstructor::class, false)) { |
|
35 | + if (!\class_exists(NamedArgumentConstructor::class, false)) |
|
36 | + { |
|
35 | 37 | /** |
36 | 38 | * Annotation that indicates that the annotated class should be |
37 | 39 | * constructed with a named argument call. |
@@ -51,7 +53,8 @@ discard block |
||
51 | 53 | |
52 | 54 | use JetBrains\PhpStorm\ExpectedValues; |
53 | 55 | |
54 | - if (!\class_exists(Attribute::class, false)) { |
|
56 | + if (!\class_exists(Attribute::class, false)) |
|
57 | + { |
|
55 | 58 | #[Attribute(Attribute::TARGET_CLASS)] |
56 | 59 | final class Attribute |
57 | 60 | { |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor; |
15 | 15 | |
16 | - if (!\interface_exists(NamedArgumentConstructorAnnotation::class)) { |
|
16 | + if (!\interface_exists(NamedArgumentConstructorAnnotation::class)){ |
|
17 | 17 | /** |
18 | 18 | * Marker interface for PHP7/PHP8 compatible support for named |
19 | 19 | * arguments (and constructor property promotion). |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | namespace Doctrine\Common\Annotations\Annotation { |
33 | 33 | |
34 | - if (!\class_exists(NamedArgumentConstructor::class, false)) { |
|
34 | + if (!\class_exists(NamedArgumentConstructor::class, false)){ |
|
35 | 35 | /** |
36 | 36 | * Annotation that indicates that the annotated class should be |
37 | 37 | * constructed with a named argument call. |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | use JetBrains\PhpStorm\ExpectedValues; |
53 | 53 | |
54 | - if (!\class_exists(Attribute::class, false)) { |
|
54 | + if (!\class_exists(Attribute::class, false)){ |
|
55 | 55 | #[Attribute(Attribute::TARGET_CLASS)] |
56 | 56 | final class Attribute |
57 | 57 | { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | $name = $name ?? $this->default; |
79 | 79 | |
80 | - if (!isset($this->buckets[$name])) { |
|
80 | + if (!isset($this->buckets[$name])){ |
|
81 | 81 | throw new InvalidArgumentException(\sprintf(self::ERROR_NOT_FOUND, $name)); |
82 | 82 | } |
83 | 83 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function add(string $name, BucketInterface $storage, bool $overwrite = false): void |
101 | 101 | { |
102 | - if ($overwrite === false && isset($this->buckets[$name])) { |
|
102 | + if ($overwrite === false && isset($this->buckets[$name])){ |
|
103 | 103 | throw new \InvalidArgumentException(\sprintf(self::ERROR_REDEFINITION, $name)); |
104 | 104 | } |
105 | 105 | |
@@ -133,22 +133,22 @@ discard block |
||
133 | 133 | $uri = $this->uriToString($uri); |
134 | 134 | $result = \parse_url($uri); |
135 | 135 | |
136 | - if ($result === false) { |
|
136 | + if ($result === false){ |
|
137 | 137 | $message = 'URI argument must be a valid URI in "[STORAGE]://[PATH_TO_FILE]" format, but `%s` given'; |
138 | 138 | throw new InvalidArgumentException(\sprintf($message, $uri)); |
139 | 139 | } |
140 | 140 | |
141 | - if (!isset($result['scheme'])) { |
|
141 | + if (!isset($result['scheme'])){ |
|
142 | 142 | $result['scheme'] = $withScheme ? $this->default : null; |
143 | 143 | } |
144 | 144 | |
145 | - if (!isset($result['host'])) { |
|
145 | + if (!isset($result['host'])){ |
|
146 | 146 | $result['host'] = ''; |
147 | 147 | } |
148 | 148 | |
149 | 149 | return [ |
150 | 150 | $result['scheme'] ?? null, |
151 | - $result['host'] . \rtrim($result['path'] ?? '', '/'), |
|
151 | + $result['host'].\rtrim($result['path'] ?? '', '/'), |
|
152 | 152 | ]; |
153 | 153 | } |
154 | 154 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | private function uriToString($uri): string |
161 | 161 | { |
162 | - switch (true) { |
|
162 | + switch (true){ |
|
163 | 163 | case $uri instanceof UriInterface: |
164 | 164 | case $uri instanceof \Stringable: |
165 | 165 | case \is_object($uri) && \method_exists($uri, '__toString'): |
@@ -77,7 +77,8 @@ discard block |
||
77 | 77 | { |
78 | 78 | $name = $name ?? $this->default; |
79 | 79 | |
80 | - if (!isset($this->buckets[$name])) { |
|
80 | + if (!isset($this->buckets[$name])) |
|
81 | + { |
|
81 | 82 | throw new InvalidArgumentException(\sprintf(self::ERROR_NOT_FOUND, $name)); |
82 | 83 | } |
83 | 84 | |
@@ -99,7 +100,8 @@ discard block |
||
99 | 100 | */ |
100 | 101 | public function add(string $name, BucketInterface $storage, bool $overwrite = false): void |
101 | 102 | { |
102 | - if ($overwrite === false && isset($this->buckets[$name])) { |
|
103 | + if ($overwrite === false && isset($this->buckets[$name])) |
|
104 | + { |
|
103 | 105 | throw new \InvalidArgumentException(\sprintf(self::ERROR_REDEFINITION, $name)); |
104 | 106 | } |
105 | 107 | |
@@ -133,16 +135,19 @@ discard block |
||
133 | 135 | $uri = $this->uriToString($uri); |
134 | 136 | $result = \parse_url($uri); |
135 | 137 | |
136 | - if ($result === false) { |
|
138 | + if ($result === false) |
|
139 | + { |
|
137 | 140 | $message = 'URI argument must be a valid URI in "[STORAGE]://[PATH_TO_FILE]" format, but `%s` given'; |
138 | 141 | throw new InvalidArgumentException(\sprintf($message, $uri)); |
139 | 142 | } |
140 | 143 | |
141 | - if (!isset($result['scheme'])) { |
|
144 | + if (!isset($result['scheme'])) |
|
145 | + { |
|
142 | 146 | $result['scheme'] = $withScheme ? $this->default : null; |
143 | 147 | } |
144 | 148 | |
145 | - if (!isset($result['host'])) { |
|
149 | + if (!isset($result['host'])) |
|
150 | + { |
|
146 | 151 | $result['host'] = ''; |
147 | 152 | } |
148 | 153 | |
@@ -159,7 +164,8 @@ discard block |
||
159 | 164 | */ |
160 | 165 | private function uriToString($uri): string |
161 | 166 | { |
162 | - switch (true) { |
|
167 | + switch (true) |
|
168 | + { |
|
163 | 169 | case $uri instanceof UriInterface: |
164 | 170 | case $uri instanceof \Stringable: |
165 | 171 | case \is_object($uri) && \method_exists($uri, '__toString'): |
@@ -64,7 +64,7 @@ |
||
64 | 64 | { |
65 | 65 | $name = $this->storage->getName(); |
66 | 66 | |
67 | - if ($name === null) { |
|
67 | + if ($name === null){ |
|
68 | 68 | return $this->getPathname(); |
69 | 69 | } |
70 | 70 |
@@ -64,7 +64,8 @@ |
||
64 | 64 | { |
65 | 65 | $name = $this->storage->getName(); |
66 | 66 | |
67 | - if ($name === null) { |
|
67 | + if ($name === null) |
|
68 | + { |
|
68 | 69 | return $this->getPathname(); |
69 | 70 | } |
70 | 71 |