@@ -136,7 +136,7 @@ |
||
| 136 | 136 | #[ExpectedValues(valuesFromClass: \League\Flysystem\Visibility::class)] |
| 137 | 137 | string $visibility |
| 138 | 138 | ): string { |
| 139 | - return $visibility === \League\Flysystem\Visibility::PUBLIC |
|
| 139 | + return $visibility === \League\Flysystem\Visibility::public |
|
| 140 | 140 | ? Visibility::VISIBILITY_PUBLIC |
| 141 | 141 | : Visibility::VISIBILITY_PRIVATE; |
| 142 | 142 | } |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $fs = $this->getOperator(); |
| 31 | 31 | |
| 32 | - try { |
|
| 32 | + try{ |
|
| 33 | 33 | return $fs->fileExists($pathname); |
| 34 | - } catch (FilesystemException $e) { |
|
| 34 | + }catch (FilesystemException $e){ |
|
| 35 | 35 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | $fs = $this->getOperator(); |
| 45 | 45 | |
| 46 | - try { |
|
| 46 | + try{ |
|
| 47 | 47 | return $fs->read($pathname); |
| 48 | - } catch (FilesystemException $e) { |
|
| 48 | + }catch (FilesystemException $e){ |
|
| 49 | 49 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $fs = $this->getOperator(); |
| 59 | 59 | |
| 60 | - try { |
|
| 60 | + try{ |
|
| 61 | 61 | return $fs->readStream($pathname); |
| 62 | - } catch (FilesystemException $e) { |
|
| 62 | + }catch (FilesystemException $e){ |
|
| 63 | 63 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $fs = $this->getOperator(); |
| 73 | 73 | |
| 74 | - try { |
|
| 74 | + try{ |
|
| 75 | 75 | return $fs->lastModified($pathname); |
| 76 | - } catch (FilesystemException $e) { |
|
| 76 | + }catch (FilesystemException $e){ |
|
| 77 | 77 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | $fs = $this->getOperator(); |
| 87 | 87 | |
| 88 | - try { |
|
| 88 | + try{ |
|
| 89 | 89 | return $fs->fileSize($pathname); |
| 90 | - } catch (FilesystemException $e) { |
|
| 90 | + }catch (FilesystemException $e){ |
|
| 91 | 91 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | { |
| 100 | 100 | $fs = $this->getOperator(); |
| 101 | 101 | |
| 102 | - try { |
|
| 102 | + try{ |
|
| 103 | 103 | return $fs->mimeType($pathname); |
| 104 | - } catch (FilesystemException $e) { |
|
| 104 | + }catch (FilesystemException $e){ |
|
| 105 | 105 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | $fs = $this->getOperator(); |
| 116 | 116 | |
| 117 | - try { |
|
| 117 | + try{ |
|
| 118 | 118 | return $this->fromFlysystemVisibility( |
| 119 | 119 | $fs->visibility($pathname) |
| 120 | 120 | ); |
| 121 | - } catch (FilesystemException $e) { |
|
| 121 | + }catch (FilesystemException $e){ |
|
| 122 | 122 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -29,9 +29,12 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $fs = $this->getOperator(); |
| 31 | 31 | |
| 32 | - try { |
|
| 32 | + try |
|
| 33 | + { |
|
| 33 | 34 | return $fs->fileExists($pathname); |
| 34 | - } catch (FilesystemException $e) { |
|
| 35 | + } |
|
| 36 | + catch (FilesystemException $e) |
|
| 37 | + { |
|
| 35 | 38 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 36 | 39 | } |
| 37 | 40 | } |
@@ -43,9 +46,12 @@ discard block |
||
| 43 | 46 | { |
| 44 | 47 | $fs = $this->getOperator(); |
| 45 | 48 | |
| 46 | - try { |
|
| 49 | + try |
|
| 50 | + { |
|
| 47 | 51 | return $fs->read($pathname); |
| 48 | - } catch (FilesystemException $e) { |
|
| 52 | + } |
|
| 53 | + catch (FilesystemException $e) |
|
| 54 | + { |
|
| 49 | 55 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 50 | 56 | } |
| 51 | 57 | } |
@@ -57,9 +63,12 @@ discard block |
||
| 57 | 63 | { |
| 58 | 64 | $fs = $this->getOperator(); |
| 59 | 65 | |
| 60 | - try { |
|
| 66 | + try |
|
| 67 | + { |
|
| 61 | 68 | return $fs->readStream($pathname); |
| 62 | - } catch (FilesystemException $e) { |
|
| 69 | + } |
|
| 70 | + catch (FilesystemException $e) |
|
| 71 | + { |
|
| 63 | 72 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 64 | 73 | } |
| 65 | 74 | } |
@@ -71,9 +80,12 @@ discard block |
||
| 71 | 80 | { |
| 72 | 81 | $fs = $this->getOperator(); |
| 73 | 82 | |
| 74 | - try { |
|
| 83 | + try |
|
| 84 | + { |
|
| 75 | 85 | return $fs->lastModified($pathname); |
| 76 | - } catch (FilesystemException $e) { |
|
| 86 | + } |
|
| 87 | + catch (FilesystemException $e) |
|
| 88 | + { |
|
| 77 | 89 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 78 | 90 | } |
| 79 | 91 | } |
@@ -85,9 +97,12 @@ discard block |
||
| 85 | 97 | { |
| 86 | 98 | $fs = $this->getOperator(); |
| 87 | 99 | |
| 88 | - try { |
|
| 100 | + try |
|
| 101 | + { |
|
| 89 | 102 | return $fs->fileSize($pathname); |
| 90 | - } catch (FilesystemException $e) { |
|
| 103 | + } |
|
| 104 | + catch (FilesystemException $e) |
|
| 105 | + { |
|
| 91 | 106 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 92 | 107 | } |
| 93 | 108 | } |
@@ -99,9 +114,12 @@ discard block |
||
| 99 | 114 | { |
| 100 | 115 | $fs = $this->getOperator(); |
| 101 | 116 | |
| 102 | - try { |
|
| 117 | + try |
|
| 118 | + { |
|
| 103 | 119 | return $fs->mimeType($pathname); |
| 104 | - } catch (FilesystemException $e) { |
|
| 120 | + } |
|
| 121 | + catch (FilesystemException $e) |
|
| 122 | + { |
|
| 105 | 123 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 106 | 124 | } |
| 107 | 125 | } |
@@ -114,11 +132,14 @@ discard block |
||
| 114 | 132 | { |
| 115 | 133 | $fs = $this->getOperator(); |
| 116 | 134 | |
| 117 | - try { |
|
| 135 | + try |
|
| 136 | + { |
|
| 118 | 137 | return $this->fromFlysystemVisibility( |
| 119 | 138 | $fs->visibility($pathname) |
| 120 | 139 | ); |
| 121 | - } catch (FilesystemException $e) { |
|
| 140 | + } |
|
| 141 | + catch (FilesystemException $e) |
|
| 142 | + { |
|
| 122 | 143 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 123 | 144 | } |
| 124 | 145 | } |
@@ -166,8 +166,8 @@ |
||
| 166 | 166 | string $visibility |
| 167 | 167 | ): string { |
| 168 | 168 | return ($visibility === Visibility::VISIBILITY_PUBLIC) |
| 169 | - ? \League\Flysystem\Visibility::PUBLIC |
|
| 170 | - : \League\Flysystem\Visibility::PRIVATE; |
|
| 169 | + ? \League\Flysystem\Visibility::public |
|
| 170 | + : \League\Flysystem\Visibility::private; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | public function create(string $pathname, array $config = []): FileInterface |
| 21 | 21 | { |
| 22 | - if ($this instanceof ReadableInterface && !$this->exists($pathname)) { |
|
| 22 | + if ($this instanceof ReadableInterface && !$this->exists($pathname)){ |
|
| 23 | 23 | return $this->write($pathname, '', $config); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $fs = $this->getOperator(); |
| 34 | 34 | |
| 35 | - try { |
|
| 36 | - switch (true) { |
|
| 35 | + try{ |
|
| 36 | + switch (true){ |
|
| 37 | 37 | case \is_object($content): |
| 38 | 38 | case \is_string($content): |
| 39 | 39 | $fs->write($pathname, (string)$content, $config); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $message = 'Content must be a resource stream or stringable type, but %s passed'; |
| 48 | 48 | throw new \InvalidArgumentException(\sprintf($message, \get_debug_type($content))); |
| 49 | 49 | } |
| 50 | - } catch (FilesystemException $e) { |
|
| 50 | + }catch (FilesystemException $e){ |
|
| 51 | 51 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | ): FileInterface { |
| 62 | 62 | $fs = $this->getOperator(); |
| 63 | 63 | |
| 64 | - try { |
|
| 64 | + try{ |
|
| 65 | 65 | $fs->setVisibility($pathname, $this->toFlysystemVisibility($visibility)); |
| 66 | - } catch (FilesystemException $e) { |
|
| 66 | + }catch (FilesystemException $e){ |
|
| 67 | 67 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | ): FileInterface { |
| 79 | 79 | $fs = $this->getOperator(); |
| 80 | 80 | |
| 81 | - if ($storage === null || $storage === $this) { |
|
| 82 | - try { |
|
| 81 | + if ($storage === null || $storage === $this){ |
|
| 82 | + try{ |
|
| 83 | 83 | $fs->copy($source, $destination, $config); |
| 84 | - } catch (FilesystemException $e) { |
|
| 84 | + }catch (FilesystemException $e){ |
|
| 85 | 85 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -99,10 +99,10 @@ discard block |
||
| 99 | 99 | ): FileInterface { |
| 100 | 100 | $fs = $this->getOperator(); |
| 101 | 101 | |
| 102 | - if ($storage === null || $storage === $this) { |
|
| 103 | - try { |
|
| 102 | + if ($storage === null || $storage === $this){ |
|
| 103 | + try{ |
|
| 104 | 104 | $fs->move($source, $destination, $config); |
| 105 | - } catch (FilesystemException $e) { |
|
| 105 | + }catch (FilesystemException $e){ |
|
| 106 | 106 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -120,14 +120,14 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $fs = $this->getOperator(); |
| 122 | 122 | |
| 123 | - try { |
|
| 123 | + try{ |
|
| 124 | 124 | $fs->delete($pathname); |
| 125 | 125 | |
| 126 | - if ($clean) { |
|
| 126 | + if ($clean){ |
|
| 127 | 127 | /** @psalm-suppress InternalMethod */ |
| 128 | 128 | $this->deleteEmptyDirectories($this->getParentDirectory($pathname)); |
| 129 | 129 | } |
| 130 | - } catch (FilesystemException $e) { |
|
| 130 | + }catch (FilesystemException $e){ |
|
| 131 | 131 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -182,18 +182,18 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | private function deleteEmptyDirectories(string $directory): void |
| 184 | 184 | { |
| 185 | - if (!$this->hasParentDirectory($directory)) { |
|
| 185 | + if (!$this->hasParentDirectory($directory)){ |
|
| 186 | 186 | return; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | $fs = $this->getOperator(); |
| 190 | 190 | |
| 191 | - try { |
|
| 192 | - if (!$this->hasFiles($directory)) { |
|
| 191 | + try{ |
|
| 192 | + if (!$this->hasFiles($directory)){ |
|
| 193 | 193 | $fs->deleteDirectory($directory); |
| 194 | 194 | $this->deleteEmptyDirectories($this->getParentDirectory($directory)); |
| 195 | 195 | } |
| 196 | - } catch (FilesystemException $e) { |
|
| 196 | + }catch (FilesystemException $e){ |
|
| 197 | 197 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 198 | 198 | } |
| 199 | 199 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | { |
| 216 | 216 | $fs = $this->getOperator(); |
| 217 | 217 | |
| 218 | - foreach ($fs->listContents($directory) as $_) { |
|
| 218 | + foreach ($fs->listContents($directory) as $_){ |
|
| 219 | 219 | return true; |
| 220 | 220 | } |
| 221 | 221 | |
@@ -19,7 +19,8 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | public function create(string $pathname, array $config = []): FileInterface |
| 21 | 21 | { |
| 22 | - if ($this instanceof ReadableInterface && !$this->exists($pathname)) { |
|
| 22 | + if ($this instanceof ReadableInterface && !$this->exists($pathname)) |
|
| 23 | + { |
|
| 23 | 24 | return $this->write($pathname, '', $config); |
| 24 | 25 | } |
| 25 | 26 | |
@@ -32,8 +33,10 @@ discard block |
||
| 32 | 33 | |
| 33 | 34 | $fs = $this->getOperator(); |
| 34 | 35 | |
| 35 | - try { |
|
| 36 | - switch (true) { |
|
| 36 | + try |
|
| 37 | + { |
|
| 38 | + switch (true) |
|
| 39 | + { |
|
| 37 | 40 | case \is_object($content): |
| 38 | 41 | case \is_string($content): |
| 39 | 42 | $fs->write($pathname, (string)$content, $config); |
@@ -47,7 +50,9 @@ discard block |
||
| 47 | 50 | $message = 'Content must be a resource stream or stringable type, but %s passed'; |
| 48 | 51 | throw new \InvalidArgumentException(\sprintf($message, \get_debug_type($content))); |
| 49 | 52 | } |
| 50 | - } catch (FilesystemException $e) { |
|
| 53 | + } |
|
| 54 | + catch (FilesystemException $e) |
|
| 55 | + { |
|
| 51 | 56 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 52 | 57 | } |
| 53 | 58 | |
@@ -61,9 +66,12 @@ discard block |
||
| 61 | 66 | ): FileInterface { |
| 62 | 67 | $fs = $this->getOperator(); |
| 63 | 68 | |
| 64 | - try { |
|
| 69 | + try |
|
| 70 | + { |
|
| 65 | 71 | $fs->setVisibility($pathname, $this->toFlysystemVisibility($visibility)); |
| 66 | - } catch (FilesystemException $e) { |
|
| 72 | + } |
|
| 73 | + catch (FilesystemException $e) |
|
| 74 | + { |
|
| 67 | 75 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 68 | 76 | } |
| 69 | 77 | |
@@ -78,10 +86,14 @@ discard block |
||
| 78 | 86 | ): FileInterface { |
| 79 | 87 | $fs = $this->getOperator(); |
| 80 | 88 | |
| 81 | - if ($storage === null || $storage === $this) { |
|
| 82 | - try { |
|
| 89 | + if ($storage === null || $storage === $this) |
|
| 90 | + { |
|
| 91 | + try |
|
| 92 | + { |
|
| 83 | 93 | $fs->copy($source, $destination, $config); |
| 84 | - } catch (FilesystemException $e) { |
|
| 94 | + } |
|
| 95 | + catch (FilesystemException $e) |
|
| 96 | + { |
|
| 85 | 97 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 86 | 98 | } |
| 87 | 99 | |
@@ -99,10 +111,14 @@ discard block |
||
| 99 | 111 | ): FileInterface { |
| 100 | 112 | $fs = $this->getOperator(); |
| 101 | 113 | |
| 102 | - if ($storage === null || $storage === $this) { |
|
| 103 | - try { |
|
| 114 | + if ($storage === null || $storage === $this) |
|
| 115 | + { |
|
| 116 | + try |
|
| 117 | + { |
|
| 104 | 118 | $fs->move($source, $destination, $config); |
| 105 | - } catch (FilesystemException $e) { |
|
| 119 | + } |
|
| 120 | + catch (FilesystemException $e) |
|
| 121 | + { |
|
| 106 | 122 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 107 | 123 | } |
| 108 | 124 | |
@@ -120,14 +136,18 @@ discard block |
||
| 120 | 136 | { |
| 121 | 137 | $fs = $this->getOperator(); |
| 122 | 138 | |
| 123 | - try { |
|
| 139 | + try |
|
| 140 | + { |
|
| 124 | 141 | $fs->delete($pathname); |
| 125 | 142 | |
| 126 | - if ($clean) { |
|
| 143 | + if ($clean) |
|
| 144 | + { |
|
| 127 | 145 | /** @psalm-suppress InternalMethod */ |
| 128 | 146 | $this->deleteEmptyDirectories($this->getParentDirectory($pathname)); |
| 129 | 147 | } |
| 130 | - } catch (FilesystemException $e) { |
|
| 148 | + } |
|
| 149 | + catch (FilesystemException $e) |
|
| 150 | + { |
|
| 131 | 151 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 132 | 152 | } |
| 133 | 153 | } |
@@ -182,18 +202,23 @@ discard block |
||
| 182 | 202 | */ |
| 183 | 203 | private function deleteEmptyDirectories(string $directory): void |
| 184 | 204 | { |
| 185 | - if (!$this->hasParentDirectory($directory)) { |
|
| 205 | + if (!$this->hasParentDirectory($directory)) |
|
| 206 | + { |
|
| 186 | 207 | return; |
| 187 | 208 | } |
| 188 | 209 | |
| 189 | 210 | $fs = $this->getOperator(); |
| 190 | 211 | |
| 191 | - try { |
|
| 192 | - if (!$this->hasFiles($directory)) { |
|
| 212 | + try |
|
| 213 | + { |
|
| 214 | + if (!$this->hasFiles($directory)) |
|
| 215 | + { |
|
| 193 | 216 | $fs->deleteDirectory($directory); |
| 194 | 217 | $this->deleteEmptyDirectories($this->getParentDirectory($directory)); |
| 195 | 218 | } |
| 196 | - } catch (FilesystemException $e) { |
|
| 219 | + } |
|
| 220 | + catch (FilesystemException $e) |
|
| 221 | + { |
|
| 197 | 222 | throw new FileOperationException($e->getMessage(), $e->getCode(), $e); |
| 198 | 223 | } |
| 199 | 224 | } |
@@ -215,7 +240,8 @@ discard block |
||
| 215 | 240 | { |
| 216 | 241 | $fs = $this->getOperator(); |
| 217 | 242 | |
| 218 | - foreach ($fs->listContents($directory) as $_) { |
|
| 243 | + foreach ($fs->listContents($directory) as $_) |
|
| 244 | + { |
|
| 219 | 245 | return true; |
| 220 | 246 | } |
| 221 | 247 | |
@@ -22,11 +22,11 @@ |
||
| 22 | 22 | * @var string |
| 23 | 23 | * @psalm-var VisibilityType |
| 24 | 24 | */ |
| 25 | - public const VISIBILITY_PUBLIC = \League\Flysystem\Visibility::PUBLIC; |
|
| 25 | + public const VISIBILITY_PUBLIC = \League\Flysystem\Visibility::public; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @var string |
| 29 | 29 | * @psalm-var VisibilityType |
| 30 | 30 | */ |
| 31 | - public const VISIBILITY_PRIVATE = \League\Flysystem\Visibility::PRIVATE; |
|
| 31 | + public const VISIBILITY_PRIVATE = \League\Flysystem\Visibility::private; |
|
| 32 | 32 | } |
@@ -75,6 +75,6 @@ |
||
| 75 | 75 | $prefix = \trim($this->host->getPath(), self::URI_PATH_DELIMITER); |
| 76 | 76 | $file = \trim($file, self::URI_PATH_DELIMITER); |
| 77 | 77 | |
| 78 | - return self::URI_PATH_DELIMITER . ('' === $prefix ? '' : $prefix . self::URI_PATH_DELIMITER) . $file; |
|
| 78 | + return self::URI_PATH_DELIMITER.('' === $prefix ? '' : $prefix.self::URI_PATH_DELIMITER).$file; |
|
| 79 | 79 | } |
| 80 | 80 | } |
@@ -37,7 +37,8 @@ |
||
| 37 | 37 | |
| 38 | 38 | public function render(Directive $directive): ?string |
| 39 | 39 | { |
| 40 | - if (!$this->hasDirective($directive->name)) { |
|
| 40 | + if (!$this->hasDirective($directive->name)) |
|
| 41 | + { |
|
| 41 | 42 | return null; |
| 42 | 43 | } |
| 43 | 44 | |
@@ -23,15 +23,15 @@ |
||
| 23 | 23 | |
| 24 | 24 | public function hasDirective(string $name): bool |
| 25 | 25 | { |
| 26 | - return $this->r->hasMethod('render' . \ucfirst($name)); |
|
| 26 | + return $this->r->hasMethod('render'.\ucfirst($name)); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | public function render(Directive $directive): ?string |
| 30 | 30 | { |
| 31 | - if (!$this->hasDirective($directive->name)) { |
|
| 31 | + if (!$this->hasDirective($directive->name)){ |
|
| 32 | 32 | return null; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - return \call_user_func([$this, 'render' . \ucfirst($directive->name)], $directive); |
|
| 35 | + return \call_user_func([$this, 'render'.\ucfirst($directive->name)], $directive); |
|
| 36 | 36 | } |
| 37 | 37 | } |
@@ -33,8 +33,10 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function hasDirective(string $name): bool |
| 35 | 35 | { |
| 36 | - foreach ($this->directives as $directiveRenderer) { |
|
| 37 | - if ($directiveRenderer->hasDirective($name)) { |
|
| 36 | + foreach ($this->directives as $directiveRenderer) |
|
| 37 | + { |
|
| 38 | + if ($directiveRenderer->hasDirective($name)) |
|
| 39 | + { |
|
| 38 | 40 | return true; |
| 39 | 41 | } |
| 40 | 42 | } |
@@ -44,8 +46,10 @@ discard block |
||
| 44 | 46 | |
| 45 | 47 | public function render(Directive $directive): ?string |
| 46 | 48 | { |
| 47 | - foreach ($this->directives as $directiveRenderer) { |
|
| 48 | - if ($directiveRenderer->hasDirective($directive->name)) { |
|
| 49 | + foreach ($this->directives as $directiveRenderer) |
|
| 50 | + { |
|
| 51 | + if ($directiveRenderer->hasDirective($directive->name)) |
|
| 52 | + { |
|
| 49 | 53 | return $directiveRenderer->render($directive); |
| 50 | 54 | } |
| 51 | 55 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public function __construct( |
| 15 | 15 | private array $directives = [] |
| 16 | - ) { |
|
| 16 | + ){ |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function hasDirective(string $name): bool |
| 28 | 28 | { |
| 29 | - foreach ($this->directives as $directiveRenderer) { |
|
| 30 | - if ($directiveRenderer->hasDirective($name)) { |
|
| 29 | + foreach ($this->directives as $directiveRenderer){ |
|
| 30 | + if ($directiveRenderer->hasDirective($name)){ |
|
| 31 | 31 | return true; |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function render(Directive $directive): ?string |
| 39 | 39 | { |
| 40 | - foreach ($this->directives as $directiveRenderer) { |
|
| 41 | - if ($directiveRenderer->hasDirective($directive->name)) { |
|
| 40 | + foreach ($this->directives as $directiveRenderer){ |
|
| 41 | + if ($directiveRenderer->hasDirective($directive->name)){ |
|
| 42 | 42 | return $directiveRenderer->render($directive); |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | /** @var AuthContextInterface $authContext */ |
| 29 | 29 | $authContext = $request->getAttribute(AuthMiddleware::ATTRIBUTE); |
| 30 | 30 | |
| 31 | - if ($authContext === null || $authContext->getActor() === null) { |
|
| 31 | + if ($authContext === null || $authContext->getActor() === null){ |
|
| 32 | 32 | return $this->denyAccess($request, $handler); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -28,7 +28,8 @@ |
||
| 28 | 28 | /** @var AuthContextInterface $authContext */ |
| 29 | 29 | $authContext = $request->getAttribute(AuthMiddleware::ATTRIBUTE); |
| 30 | 30 | |
| 31 | - if ($authContext === null || $authContext->getActor() === null) { |
|
| 31 | + if ($authContext === null || $authContext->getActor() === null) |
|
| 32 | + { |
|
| 32 | 33 | return $this->denyAccess($request, $handler); |
| 33 | 34 | } |
| 34 | 35 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function testGetsWithExistsValueAndCacheFile(): void |
| 39 | 39 | { |
| 40 | 40 | $ttl = time() + self::DEFAULT_TTL; |
| 41 | - $value = $ttl . 's:3:"bar";'; |
|
| 41 | + $value = $ttl.'s:3:"bar";'; |
|
| 42 | 42 | $path = self::DEFAULT_PATH; |
| 43 | 43 | |
| 44 | 44 | $this->files->shouldReceive('read')->with($path)->andReturn($value); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | $path = self::DEFAULT_PATH; |
| 63 | 63 | |
| 64 | - $this->files->shouldReceive('read')->with($path)->andReturn(time() . 's:3:"bar";'); |
|
| 64 | + $this->files->shouldReceive('read')->with($path)->andReturn(time().'s:3:"bar";'); |
|
| 65 | 65 | $this->files->shouldReceive('exists')->with($path)->andReturn(true); |
| 66 | 66 | $this->files->shouldReceive('delete')->with($path)->andReturnTrue(); |
| 67 | 67 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function testGetsWithExistsValueWithDeadValue(): void |
| 72 | 72 | { |
| 73 | 73 | $ttl = time() + self::DEFAULT_TTL; |
| 74 | - $value = $ttl . 's:3:"barbar";'; |
|
| 74 | + $value = $ttl.'s:3:"barbar";'; |
|
| 75 | 75 | $path = self::DEFAULT_PATH; |
| 76 | 76 | |
| 77 | 77 | $this->files->shouldReceive('read')->with($path)->andReturn($value); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public function testSetsWithDefaultTTL(): void |
| 85 | 85 | { |
| 86 | 86 | $ttl = time() + self::DEFAULT_TTL; |
| 87 | - $value = $ttl . 's:3:"bar";'; |
|
| 87 | + $value = $ttl.'s:3:"bar";'; |
|
| 88 | 88 | |
| 89 | 89 | $this->files->shouldReceive('write')->with(self::DEFAULT_PATH, $value, null, true)->andReturnTrue(); |
| 90 | 90 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | public function testSetsWithTTLInSeconds(): void |
| 95 | 95 | { |
| 96 | 96 | $ttl = time() + 30; |
| 97 | - $value = $ttl . 's:3:"bar";'; |
|
| 97 | + $value = $ttl.'s:3:"bar";'; |
|
| 98 | 98 | |
| 99 | 99 | $this->files->shouldReceive('write')->with(self::DEFAULT_PATH, $value, null, true)->andReturnTrue(); |
| 100 | 100 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | public function testSetsWithTTLInDateInterval(): void |
| 105 | 105 | { |
| 106 | 106 | $ttl = time() + 30; |
| 107 | - $value = $ttl . 's:3:"bar";'; |
|
| 107 | + $value = $ttl.'s:3:"bar";'; |
|
| 108 | 108 | |
| 109 | 109 | $this->files->shouldReceive('write')->with(self::DEFAULT_PATH, $value, null, true)->andReturnTrue(); |
| 110 | 110 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | public function testSetsWithTTLInDateTime(): void |
| 115 | 115 | { |
| 116 | 116 | $ttl = time() + 30; |
| 117 | - $value = $ttl . 's:3:"bar";'; |
|
| 117 | + $value = $ttl.'s:3:"bar";'; |
|
| 118 | 118 | |
| 119 | 119 | $this->files->shouldReceive('write')->with(self::DEFAULT_PATH, $value, null, true)->andReturnTrue(); |
| 120 | 120 | |
@@ -161,15 +161,15 @@ discard block |
||
| 161 | 161 | { |
| 162 | 162 | $this->files->shouldReceive('read')->with( |
| 163 | 163 | 'path/to/cache/0b/ee/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' |
| 164 | - )->andReturn((time() + self::DEFAULT_TTL) . 's:3:"abc";'); |
|
| 164 | + )->andReturn((time() + self::DEFAULT_TTL).'s:3:"abc";'); |
|
| 165 | 165 | |
| 166 | 166 | $this->files->shouldReceive('read')->with( |
| 167 | 167 | 'path/to/cache/62/cd/62cdb7020ff920e5aa642c3d4066950dd1f01f4d' |
| 168 | - )->andReturn((time() + self::DEFAULT_TTL) . 's:3:"cde";'); |
|
| 168 | + )->andReturn((time() + self::DEFAULT_TTL).'s:3:"cde";'); |
|
| 169 | 169 | |
| 170 | 170 | $this->files->shouldReceive('read')->with( |
| 171 | 171 | 'path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2' |
| 172 | - )->andReturn((time() + -1) . 's:3:"efg";'); |
|
| 172 | + )->andReturn((time() + -1).'s:3:"efg";'); |
|
| 173 | 173 | $this->files->shouldReceive('exists')->with( |
| 174 | 174 | 'path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2' |
| 175 | 175 | )->andReturnFalse(); |
@@ -186,15 +186,15 @@ discard block |
||
| 186 | 186 | $ttl = time() + self::DEFAULT_TTL; |
| 187 | 187 | |
| 188 | 188 | $this->files->shouldReceive('write') |
| 189 | - ->with('path/to/cache/0b/ee/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', $ttl . 's:3:"baz";', null, true) |
|
| 189 | + ->with('path/to/cache/0b/ee/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', $ttl.'s:3:"baz";', null, true) |
|
| 190 | 190 | ->andReturnTrue(); |
| 191 | 191 | |
| 192 | 192 | $this->files->shouldReceive('write') |
| 193 | - ->with('path/to/cache/62/cd/62cdb7020ff920e5aa642c3d4066950dd1f01f4d', $ttl . 's:3:"foo";', null, true) |
|
| 193 | + ->with('path/to/cache/62/cd/62cdb7020ff920e5aa642c3d4066950dd1f01f4d', $ttl.'s:3:"foo";', null, true) |
|
| 194 | 194 | ->andReturnTrue(); |
| 195 | 195 | |
| 196 | 196 | $this->files->shouldReceive('write') |
| 197 | - ->with('path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2', $ttl . 's:3:"bar";', null, true) |
|
| 197 | + ->with('path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2', $ttl.'s:3:"bar";', null, true) |
|
| 198 | 198 | ->andReturnTrue(); |
| 199 | 199 | |
| 200 | 200 | $this->assertTrue( |
@@ -211,15 +211,15 @@ discard block |
||
| 211 | 211 | $ttl = time() + 30; |
| 212 | 212 | |
| 213 | 213 | $this->files->shouldReceive('write') |
| 214 | - ->with('path/to/cache/0b/ee/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', $ttl . 's:3:"baz";', null, true) |
|
| 214 | + ->with('path/to/cache/0b/ee/0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33', $ttl.'s:3:"baz";', null, true) |
|
| 215 | 215 | ->andReturnTrue(); |
| 216 | 216 | |
| 217 | 217 | $this->files->shouldReceive('write') |
| 218 | - ->with('path/to/cache/62/cd/62cdb7020ff920e5aa642c3d4066950dd1f01f4d', $ttl . 's:3:"foo";', null, true) |
|
| 218 | + ->with('path/to/cache/62/cd/62cdb7020ff920e5aa642c3d4066950dd1f01f4d', $ttl.'s:3:"foo";', null, true) |
|
| 219 | 219 | ->andReturnTrue(); |
| 220 | 220 | |
| 221 | 221 | $this->files->shouldReceive('write') |
| 222 | - ->with('path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2', $ttl . 's:3:"bar";', null, true) |
|
| 222 | + ->with('path/to/cache/bb/e9/bbe960a25ea311d21d40669e93df2003ba9b90a2', $ttl.'s:3:"bar";', null, true) |
|
| 223 | 223 | ->andReturnTrue(); |
| 224 | 224 | |
| 225 | 225 | $this->assertTrue( |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | public function patch(array $config): array |
| 27 | 27 | { |
| 28 | - foreach ($this->patches as $patch) { |
|
| 28 | + foreach ($this->patches as $patch){ |
|
| 29 | 29 | $config = $patch->patch($config); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -25,7 +25,8 @@ |
||
| 25 | 25 | |
| 26 | 26 | public function patch(array $config): array |
| 27 | 27 | { |
| 28 | - foreach ($this->patches as $patch) { |
|
| 28 | + foreach ($this->patches as $patch) |
|
| 29 | + { |
|
| 29 | 30 | $config = $patch->patch($config); |
| 30 | 31 | } |
| 31 | 32 | |