@@ -23,7 +23,7 @@ |
||
| 23 | 23 | public const RUNTIME = 0666; |
| 24 | 24 | |
| 25 | 25 | //Only owner can write |
| 26 | - public const READONLY = 0644; |
|
| 26 | + public const readonly = 0644; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Few size constants for better size manipulations. |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | public const NONE = 'None'; |
| 12 | 12 | |
| 13 | 13 | private const VALUES = [self::STRICT, self::LAX, self::NONE]; |
| 14 | - private const DEFAULT = self::LAX; |
|
| 14 | + private const default = self::LAX; |
|
| 15 | 15 | |
| 16 | 16 | private ?string $sameSite = null; |
| 17 | 17 | |
@@ -36,6 +36,6 @@ discard block |
||
| 36 | 36 | return null; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - return ($sameSite === self::NONE && !$secure) ? self::DEFAULT : $sameSite; |
|
| 39 | + return ($sameSite === self::NONE && !$secure) ? self::default : $sameSite; |
|
| 40 | 40 | } |
| 41 | 41 | } |
@@ -27,12 +27,12 @@ |
||
| 27 | 27 | |
| 28 | 28 | private function defineValue(?string $sameSite, bool $secure): ?string |
| 29 | 29 | { |
| 30 | - if ($sameSite === null) { |
|
| 30 | + if ($sameSite === null){ |
|
| 31 | 31 | return null; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $sameSite = \ucfirst(\strtolower($sameSite)); |
| 35 | - if (!\in_array($sameSite, self::VALUES, true)) { |
|
| 35 | + if (!\in_array($sameSite, self::VALUES, true)){ |
|
| 36 | 36 | return null; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -27,12 +27,14 @@ |
||
| 27 | 27 | |
| 28 | 28 | private function defineValue(?string $sameSite, bool $secure): ?string |
| 29 | 29 | { |
| 30 | - if ($sameSite === null) { |
|
| 30 | + if ($sameSite === null) |
|
| 31 | + { |
|
| 31 | 32 | return null; |
| 32 | 33 | } |
| 33 | 34 | |
| 34 | 35 | $sameSite = \ucfirst(\strtolower($sameSite)); |
| 35 | - if (!\in_array($sameSite, self::VALUES, true)) { |
|
| 36 | + if (!\in_array($sameSite, self::VALUES, true)) |
|
| 37 | + { |
|
| 36 | 38 | return null; |
| 37 | 39 | } |
| 38 | 40 | |
@@ -29,7 +29,8 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function __construct(array $visitors = []) |
| 31 | 31 | { |
| 32 | - foreach ($visitors as $visitor) { |
|
| 32 | + foreach ($visitors as $visitor) |
|
| 33 | + { |
|
| 33 | 34 | $this->addVisitor($visitor); |
| 34 | 35 | } |
| 35 | 36 | } |
@@ -44,8 +45,10 @@ discard block |
||
| 44 | 45 | |
| 45 | 46 | public function removeVisitor(VisitorInterface $visitor): void |
| 46 | 47 | { |
| 47 | - foreach ($this->visitors as $index => $added) { |
|
| 48 | - if ($added === $visitor) { |
|
| 48 | + foreach ($this->visitors as $index => $added) |
|
| 49 | + { |
|
| 50 | + if ($added === $visitor) |
|
| 51 | + { |
|
| 49 | 52 | unset($this->visitors[$index]); |
| 50 | 53 | break; |
| 51 | 54 | } |
@@ -64,22 +67,27 @@ discard block |
||
| 64 | 67 | $context ??= new VisitorContext(); |
| 65 | 68 | |
| 66 | 69 | $ctx = clone $context; |
| 67 | - foreach ($nodes as $index => $node) { |
|
| 68 | - if ($this->stopTraversal) { |
|
| 70 | + foreach ($nodes as $index => $node) |
|
| 71 | + { |
|
| 72 | + if ($this->stopTraversal) |
|
| 73 | + { |
|
| 69 | 74 | break; |
| 70 | 75 | } |
| 71 | 76 | |
| 72 | 77 | $traverseChildren = true; |
| 73 | 78 | $breakVisitorID = null; |
| 74 | 79 | |
| 75 | - if ($node instanceof NodeInterface) { |
|
| 80 | + if ($node instanceof NodeInterface) |
|
| 81 | + { |
|
| 76 | 82 | $ctx = $context->withNode($node); |
| 77 | 83 | } |
| 78 | 84 | |
| 79 | - foreach ($this->visitors as $visitorID => $visitor) { |
|
| 85 | + foreach ($this->visitors as $visitorID => $visitor) |
|
| 86 | + { |
|
| 80 | 87 | $result = $visitor->enterNode($node, $ctx); |
| 81 | 88 | |
| 82 | - switch (true) { |
|
| 89 | + switch (true) |
|
| 90 | + { |
|
| 83 | 91 | case $result === null: |
| 84 | 92 | break; |
| 85 | 93 | |
@@ -109,17 +117,21 @@ discard block |
||
| 109 | 117 | } |
| 110 | 118 | |
| 111 | 119 | // sub nodes |
| 112 | - if ($traverseChildren && $node instanceof NodeInterface) { |
|
| 120 | + if ($traverseChildren && $node instanceof NodeInterface) |
|
| 121 | + { |
|
| 113 | 122 | $nodes[$index] = $this->traverseNode($node, $ctx); |
| 114 | - if ($this->stopTraversal) { |
|
| 123 | + if ($this->stopTraversal) |
|
| 124 | + { |
|
| 115 | 125 | break; |
| 116 | 126 | } |
| 117 | 127 | } |
| 118 | 128 | |
| 119 | - foreach ($this->visitors as $visitorID => $visitor) { |
|
| 129 | + foreach ($this->visitors as $visitorID => $visitor) |
|
| 130 | + { |
|
| 120 | 131 | $result = $visitor->leaveNode($node, $ctx); |
| 121 | 132 | |
| 122 | - switch (true) { |
|
| 133 | + switch (true) |
|
| 134 | + { |
|
| 123 | 135 | case $result === null: |
| 124 | 136 | break; |
| 125 | 137 | |
@@ -141,7 +153,8 @@ discard block |
||
| 141 | 153 | ); |
| 142 | 154 | } |
| 143 | 155 | |
| 144 | - if ($breakVisitorID === $visitorID) { |
|
| 156 | + if ($breakVisitorID === $visitorID) |
|
| 157 | + { |
|
| 145 | 158 | break; |
| 146 | 159 | } |
| 147 | 160 | } |
@@ -156,18 +169,22 @@ discard block |
||
| 156 | 169 | private function traverseNode(NodeInterface $node, VisitorContext $context): NodeInterface |
| 157 | 170 | { |
| 158 | 171 | $ctx = clone $context; |
| 159 | - foreach ($node as $name => $_) { |
|
| 172 | + foreach ($node as $name => $_) |
|
| 173 | + { |
|
| 160 | 174 | $child = &$node->$name; |
| 161 | - if (is_array($child)) { |
|
| 175 | + if (is_array($child)) |
|
| 176 | + { |
|
| 162 | 177 | $child = $this->traverse($child, $ctx); |
| 163 | - if ($this->stopTraversal) { |
|
| 178 | + if ($this->stopTraversal) |
|
| 179 | + { |
|
| 164 | 180 | break; |
| 165 | 181 | } |
| 166 | 182 | |
| 167 | 183 | continue; |
| 168 | 184 | } |
| 169 | 185 | |
| 170 | - if (!$child instanceof NodeInterface) { |
|
| 186 | + if (!$child instanceof NodeInterface) |
|
| 187 | + { |
|
| 171 | 188 | continue; |
| 172 | 189 | } |
| 173 | 190 | |
@@ -176,9 +193,11 @@ discard block |
||
| 176 | 193 | $traverseChildren = true; |
| 177 | 194 | $breakVisitorID = null; |
| 178 | 195 | |
| 179 | - foreach ($this->visitors as $visitorID => $visitor) { |
|
| 196 | + foreach ($this->visitors as $visitorID => $visitor) |
|
| 197 | + { |
|
| 180 | 198 | $result = $visitor->enterNode($child, $ctx); |
| 181 | - switch (true) { |
|
| 199 | + switch (true) |
|
| 200 | + { |
|
| 182 | 201 | case $result === null: |
| 183 | 202 | break; |
| 184 | 203 | |
@@ -206,17 +225,21 @@ discard block |
||
| 206 | 225 | } |
| 207 | 226 | } |
| 208 | 227 | |
| 209 | - if ($traverseChildren) { |
|
| 228 | + if ($traverseChildren) |
|
| 229 | + { |
|
| 210 | 230 | $child = $this->traverseNode($child, $ctx); |
| 211 | - if ($this->stopTraversal) { |
|
| 231 | + if ($this->stopTraversal) |
|
| 232 | + { |
|
| 212 | 233 | break; |
| 213 | 234 | } |
| 214 | 235 | } |
| 215 | 236 | |
| 216 | - foreach ($this->visitors as $visitorID => $visitor) { |
|
| 237 | + foreach ($this->visitors as $visitorID => $visitor) |
|
| 238 | + { |
|
| 217 | 239 | $result = $visitor->leaveNode($child, $ctx); |
| 218 | 240 | |
| 219 | - switch (true) { |
|
| 241 | + switch (true) |
|
| 242 | + { |
|
| 220 | 243 | case $result === null: |
| 221 | 244 | break; |
| 222 | 245 | |
@@ -234,7 +257,8 @@ discard block |
||
| 234 | 257 | ); |
| 235 | 258 | } |
| 236 | 259 | |
| 237 | - if ($breakVisitorID === $visitorID) { |
|
| 260 | + if ($breakVisitorID === $visitorID) |
|
| 261 | + { |
|
| 238 | 262 | break; |
| 239 | 263 | } |
| 240 | 264 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function __construct(array $visitors = []) |
| 21 | 21 | { |
| 22 | - foreach ($visitors as $visitor) { |
|
| 22 | + foreach ($visitors as $visitor){ |
|
| 23 | 23 | $this->addVisitor($visitor); |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function removeVisitor(VisitorInterface $visitor): void |
| 36 | 36 | { |
| 37 | - foreach ($this->visitors as $index => $added) { |
|
| 38 | - if ($added === $visitor) { |
|
| 37 | + foreach ($this->visitors as $index => $added){ |
|
| 38 | + if ($added === $visitor){ |
|
| 39 | 39 | unset($this->visitors[$index]); |
| 40 | 40 | break; |
| 41 | 41 | } |
@@ -56,22 +56,22 @@ discard block |
||
| 56 | 56 | $context ??= new VisitorContext(); |
| 57 | 57 | |
| 58 | 58 | $ctx = clone $context; |
| 59 | - foreach ($nodes as $index => $node) { |
|
| 60 | - if ($this->stopTraversal) { |
|
| 59 | + foreach ($nodes as $index => $node){ |
|
| 60 | + if ($this->stopTraversal){ |
|
| 61 | 61 | break; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $traverseChildren = true; |
| 65 | 65 | $breakVisitorID = null; |
| 66 | 66 | |
| 67 | - if ($node instanceof NodeInterface) { |
|
| 67 | + if ($node instanceof NodeInterface){ |
|
| 68 | 68 | $ctx = $context->withNode($node); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - foreach ($this->visitors as $visitorID => $visitor) { |
|
| 71 | + foreach ($this->visitors as $visitorID => $visitor){ |
|
| 72 | 72 | $result = $visitor->enterNode($node, $ctx); |
| 73 | 73 | |
| 74 | - switch (true) { |
|
| 74 | + switch (true){ |
|
| 75 | 75 | case $result === null: |
| 76 | 76 | break; |
| 77 | 77 | |
@@ -95,23 +95,23 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | default: |
| 97 | 97 | throw new \LogicException( |
| 98 | - 'enterNode() returned invalid value of type ' . \gettype($result) |
|
| 98 | + 'enterNode() returned invalid value of type '.\gettype($result) |
|
| 99 | 99 | ); |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // sub nodes |
| 104 | - if ($traverseChildren && $node instanceof NodeInterface) { |
|
| 104 | + if ($traverseChildren && $node instanceof NodeInterface){ |
|
| 105 | 105 | $nodes[$index] = $this->traverseNode($node, $ctx); |
| 106 | - if ($this->stopTraversal) { |
|
| 106 | + if ($this->stopTraversal){ |
|
| 107 | 107 | break; |
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - foreach ($this->visitors as $visitorID => $visitor) { |
|
| 111 | + foreach ($this->visitors as $visitorID => $visitor){ |
|
| 112 | 112 | $result = $visitor->leaveNode($node, $ctx); |
| 113 | 113 | |
| 114 | - switch (true) { |
|
| 114 | + switch (true){ |
|
| 115 | 115 | case $result === null: |
| 116 | 116 | break; |
| 117 | 117 | |
@@ -129,11 +129,11 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | default: |
| 131 | 131 | throw new \LogicException( |
| 132 | - 'leaveNode() returned invalid value of type ' . gettype($result) |
|
| 132 | + 'leaveNode() returned invalid value of type '.gettype($result) |
|
| 133 | 133 | ); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if ($breakVisitorID === $visitorID) { |
|
| 136 | + if ($breakVisitorID === $visitorID){ |
|
| 137 | 137 | break; |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -148,18 +148,18 @@ discard block |
||
| 148 | 148 | private function traverseNode(NodeInterface $node, VisitorContext $context): NodeInterface |
| 149 | 149 | { |
| 150 | 150 | $ctx = clone $context; |
| 151 | - foreach ($node as $name => $_) { |
|
| 151 | + foreach ($node as $name => $_){ |
|
| 152 | 152 | $child = &$node->$name; |
| 153 | - if (is_array($child)) { |
|
| 153 | + if (is_array($child)){ |
|
| 154 | 154 | $child = $this->traverse($child, $ctx); |
| 155 | - if ($this->stopTraversal) { |
|
| 155 | + if ($this->stopTraversal){ |
|
| 156 | 156 | break; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | continue; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if (!$child instanceof NodeInterface) { |
|
| 162 | + if (!$child instanceof NodeInterface){ |
|
| 163 | 163 | continue; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -168,9 +168,9 @@ discard block |
||
| 168 | 168 | $traverseChildren = true; |
| 169 | 169 | $breakVisitorID = null; |
| 170 | 170 | |
| 171 | - foreach ($this->visitors as $visitorID => $visitor) { |
|
| 171 | + foreach ($this->visitors as $visitorID => $visitor){ |
|
| 172 | 172 | $result = $visitor->enterNode($child, $ctx); |
| 173 | - switch (true) { |
|
| 173 | + switch (true){ |
|
| 174 | 174 | case $result === null: |
| 175 | 175 | break; |
| 176 | 176 | |
@@ -193,22 +193,22 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | default: |
| 195 | 195 | throw new \LogicException( |
| 196 | - 'enterNode() returned invalid value of type ' . \gettype($result) |
|
| 196 | + 'enterNode() returned invalid value of type '.\gettype($result) |
|
| 197 | 197 | ); |
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - if ($traverseChildren) { |
|
| 201 | + if ($traverseChildren){ |
|
| 202 | 202 | $child = $this->traverseNode($child, $ctx); |
| 203 | - if ($this->stopTraversal) { |
|
| 203 | + if ($this->stopTraversal){ |
|
| 204 | 204 | break; |
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - foreach ($this->visitors as $visitorID => $visitor) { |
|
| 208 | + foreach ($this->visitors as $visitorID => $visitor){ |
|
| 209 | 209 | $result = $visitor->leaveNode($child, $ctx); |
| 210 | 210 | |
| 211 | - switch (true) { |
|
| 211 | + switch (true){ |
|
| 212 | 212 | case $result === null: |
| 213 | 213 | break; |
| 214 | 214 | |
@@ -222,11 +222,11 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | default: |
| 224 | 224 | throw new \LogicException( |
| 225 | - 'leaveNode() returned invalid value of type ' . \gettype($result) |
|
| 225 | + 'leaveNode() returned invalid value of type '.\gettype($result) |
|
| 226 | 226 | ); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - if ($breakVisitorID === $visitorID) { |
|
| 229 | + if ($breakVisitorID === $visitorID){ |
|
| 230 | 230 | break; |
| 231 | 231 | } |
| 232 | 232 | } |
@@ -70,14 +70,17 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | private function initContext(Request $request, AuthContextInterface $authContext): AuthContextInterface |
| 72 | 72 | { |
| 73 | - foreach ($this->transportRegistry->getTransports() as $name => $transport) { |
|
| 73 | + foreach ($this->transportRegistry->getTransports() as $name => $transport) |
|
| 74 | + { |
|
| 74 | 75 | $tokenID = $transport->fetchToken($request); |
| 75 | - if ($tokenID === null) { |
|
| 76 | + if ($tokenID === null) |
|
| 77 | + { |
|
| 76 | 78 | continue; |
| 77 | 79 | } |
| 78 | 80 | |
| 79 | 81 | $token = $this->tokenStorage->load($tokenID); |
| 80 | - if ($token === null) { |
|
| 82 | + if ($token === null) |
|
| 83 | + { |
|
| 81 | 84 | continue; |
| 82 | 85 | } |
| 83 | 86 | |
@@ -91,13 +94,15 @@ discard block |
||
| 91 | 94 | |
| 92 | 95 | private function closeContext(Request $request, Response $response, AuthContextInterface $authContext): Response |
| 93 | 96 | { |
| 94 | - if ($authContext->getToken() === null) { |
|
| 97 | + if ($authContext->getToken() === null) |
|
| 98 | + { |
|
| 95 | 99 | return $response; |
| 96 | 100 | } |
| 97 | 101 | |
| 98 | 102 | $transport = $this->transportRegistry->getTransport($authContext->getTransport()); |
| 99 | 103 | |
| 100 | - if ($authContext->isClosed()) { |
|
| 104 | + if ($authContext->isClosed()) |
|
| 105 | + { |
|
| 101 | 106 | $this->tokenStorage->delete($authContext->getToken()); |
| 102 | 107 | |
| 103 | 108 | return $transport->removeToken( |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | private readonly TokenStorageInterface $tokenStorage, |
| 30 | 30 | private readonly TransportRegistry $transportRegistry, |
| 31 | 31 | private readonly ?EventDispatcherInterface $eventDispatcher = null |
| 32 | - ) { |
|
| 32 | + ){ |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -49,14 +49,14 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | private function initContext(Request $request, AuthContextInterface $authContext): AuthContextInterface |
| 51 | 51 | { |
| 52 | - foreach ($this->transportRegistry->getTransports() as $name => $transport) { |
|
| 52 | + foreach ($this->transportRegistry->getTransports() as $name => $transport){ |
|
| 53 | 53 | $tokenID = $transport->fetchToken($request); |
| 54 | - if ($tokenID === null) { |
|
| 54 | + if ($tokenID === null){ |
|
| 55 | 55 | continue; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | $token = $this->tokenStorage->load($tokenID); |
| 59 | - if ($token === null) { |
|
| 59 | + if ($token === null){ |
|
| 60 | 60 | continue; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | private function closeContext(Request $request, Response $response, AuthContextInterface $authContext): Response |
| 72 | 72 | { |
| 73 | - if ($authContext->getToken() === null) { |
|
| 73 | + if ($authContext->getToken() === null){ |
|
| 74 | 74 | return $response; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $transport = $this->transportRegistry->getTransport($authContext->getTransport()); |
| 78 | 78 | |
| 79 | - if ($authContext->isClosed()) { |
|
| 79 | + if ($authContext->isClosed()){ |
|
| 80 | 80 | $this->tokenStorage->delete($authContext->getToken()); |
| 81 | 81 | |
| 82 | 82 | return $transport->removeToken( |
@@ -30,7 +30,8 @@ |
||
| 30 | 30 | // Replaces alias with real storage name |
| 31 | 31 | $name = $this->config->getAliases()[$name] ?? $name; |
| 32 | 32 | |
| 33 | - if (isset($this->connections[$name])) { |
|
| 33 | + if (isset($this->connections[$name])) |
|
| 34 | + { |
|
| 34 | 35 | return $this->connections[$name]; |
| 35 | 36 | } |
| 36 | 37 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | public function __construct( |
| 17 | 17 | private readonly FactoryInterface $factory, |
| 18 | 18 | private readonly BroadcastConfig $config |
| 19 | - ) { |
|
| 19 | + ){ |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function connection(?string $name = null): BroadcastInterface |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | // Replaces alias with real storage name |
| 27 | 27 | $name = $this->config->getAliases()[$name] ?? $name; |
| 28 | 28 | |
| 29 | - if (isset($this->connections[$name])) { |
|
| 29 | + if (isset($this->connections[$name])){ |
|
| 30 | 30 | return $this->connections[$name]; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -58,10 +58,10 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | public function getChunkSize(): ?int |
| 60 | 60 | { |
| 61 | - if (\is_null($this->config['chunkSize']) || (int) $this->config['chunkSize'] < 0) { |
|
| 61 | + if (\is_null($this->config['chunkSize']) || (int)$this->config['chunkSize'] < 0){ |
|
| 62 | 62 | return null; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - return (int) $this->config['chunkSize']; |
|
| 65 | + return (int)$this->config['chunkSize']; |
|
| 66 | 66 | } |
| 67 | 67 | } |
@@ -58,7 +58,8 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | public function getChunkSize(): ?int |
| 60 | 60 | { |
| 61 | - if (\is_null($this->config['chunkSize']) || (int) $this->config['chunkSize'] < 0) { |
|
| 61 | + if (\is_null($this->config['chunkSize']) || (int) $this->config['chunkSize'] < 0) |
|
| 62 | + { |
|
| 62 | 63 | return null; |
| 63 | 64 | } |
| 64 | 65 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | $reflection = new \ReflectionClass($object); |
| 25 | 25 | |
| 26 | - if ($reflection->implementsInterface(QueueableInterface::class)) { |
|
| 26 | + if ($reflection->implementsInterface(QueueableInterface::class)){ |
|
| 27 | 27 | return true; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | $reflection = new \ReflectionClass($object); |
| 39 | 39 | |
| 40 | 40 | $attribute = $this->reader->firstClassMetadata($reflection, Queueable::class); |
| 41 | - if ($attribute !== null) { |
|
| 41 | + if ($attribute !== null){ |
|
| 42 | 42 | return $attribute->queue; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if (\is_object($object) && $reflection->hasMethod('getQueue')) { |
|
| 45 | + if (\is_object($object) && $reflection->hasMethod('getQueue')){ |
|
| 46 | 46 | return $reflection->getMethod('getQueue')->invoke($object); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -23,7 +23,8 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | $reflection = new \ReflectionClass($object); |
| 25 | 25 | |
| 26 | - if ($reflection->implementsInterface(QueueableInterface::class)) { |
|
| 26 | + if ($reflection->implementsInterface(QueueableInterface::class)) |
|
| 27 | + { |
|
| 27 | 28 | return true; |
| 28 | 29 | } |
| 29 | 30 | |
@@ -38,11 +39,13 @@ discard block |
||
| 38 | 39 | $reflection = new \ReflectionClass($object); |
| 39 | 40 | |
| 40 | 41 | $attribute = $this->reader->firstClassMetadata($reflection, Queueable::class); |
| 41 | - if ($attribute !== null) { |
|
| 42 | + if ($attribute !== null) |
|
| 43 | + { |
|
| 42 | 44 | return $attribute->queue; |
| 43 | 45 | } |
| 44 | 46 | |
| 45 | - if (\is_object($object) && $reflection->hasMethod('getQueue')) { |
|
| 47 | + if (\is_object($object) && $reflection->hasMethod('getQueue')) |
|
| 48 | + { |
|
| 46 | 49 | return $reflection->getMethod('getQueue')->invoke($object); |
| 47 | 50 | } |
| 48 | 51 | |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | public function __construct( |
| 14 | 14 | private readonly ProcessRunner $processRunner |
| 15 | - ) { |
|
| 15 | + ){ |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | /** |
@@ -13,8 +13,8 @@ discard block |
||
| 13 | 13 | public function __construct( |
| 14 | 14 | private readonly TagParserInterface $parser, |
| 15 | 15 | private ?string $gitDirectory = null |
| 16 | - ) { |
|
| 17 | - if ($gitDirectory === null) { |
|
| 16 | + ){ |
|
| 17 | + if ($gitDirectory === null){ |
|
| 18 | 18 | $this->gitDirectory = \dirname(__DIR__); |
| 19 | 19 | } |
| 20 | 20 | } |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | $mostRecentVersion = $this->findMostRecentVersion($version); |
| 33 | 33 | |
| 34 | 34 | // no tag yet |
| 35 | - if ($mostRecentVersion === null) { |
|
| 35 | + if ($mostRecentVersion === null){ |
|
| 36 | 36 | return; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // validation |
| 40 | 40 | $mostRecentVersion = new Version(\strtolower($mostRecentVersion)); |
| 41 | - if ($version->isGreaterThan($mostRecentVersion)) { |
|
| 41 | + if ($version->isGreaterThan($mostRecentVersion)){ |
|
| 42 | 42 | return; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -52,23 +52,23 @@ discard block |
||
| 52 | 52 | private function findMostRecentVersion(Version $version): ?string |
| 53 | 53 | { |
| 54 | 54 | $tags = []; |
| 55 | - foreach ($this->parser->parse($this->gitDirectory) as $tag) { |
|
| 55 | + foreach ($this->parser->parse($this->gitDirectory) as $tag){ |
|
| 56 | 56 | $tag = new Version(\strtolower($tag)); |
| 57 | 57 | |
| 58 | 58 | // all previous major versions |
| 59 | - if ($version->getMajor()->getValue() > $tag->getMajor()->getValue()) { |
|
| 59 | + if ($version->getMajor()->getValue() > $tag->getMajor()->getValue()){ |
|
| 60 | 60 | $tags[] = $tag; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // all minor versions up to the requested in the requested major version |
| 64 | - if ($version->getMajor()->getValue() === $tag->getMajor()->getValue()) { |
|
| 65 | - if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue()) { |
|
| 64 | + if ($version->getMajor()->getValue() === $tag->getMajor()->getValue()){ |
|
| 65 | + if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue()){ |
|
| 66 | 66 | $tags[] = $tag; |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if ($tags === []) { |
|
| 71 | + if ($tags === []){ |
|
| 72 | 72 | return null; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -14,7 +14,8 @@ discard block |
||
| 14 | 14 | private readonly TagParserInterface $parser, |
| 15 | 15 | private ?string $gitDirectory = null |
| 16 | 16 | ) { |
| 17 | - if ($gitDirectory === null) { |
|
| 17 | + if ($gitDirectory === null) |
|
| 18 | + { |
|
| 18 | 19 | $this->gitDirectory = \dirname(__DIR__); |
| 19 | 20 | } |
| 20 | 21 | } |
@@ -32,13 +33,15 @@ discard block |
||
| 32 | 33 | $mostRecentVersion = $this->findMostRecentVersion($version); |
| 33 | 34 | |
| 34 | 35 | // no tag yet |
| 35 | - if ($mostRecentVersion === null) { |
|
| 36 | + if ($mostRecentVersion === null) |
|
| 37 | + { |
|
| 36 | 38 | return; |
| 37 | 39 | } |
| 38 | 40 | |
| 39 | 41 | // validation |
| 40 | 42 | $mostRecentVersion = new Version(\strtolower($mostRecentVersion)); |
| 41 | - if ($version->isGreaterThan($mostRecentVersion)) { |
|
| 43 | + if ($version->isGreaterThan($mostRecentVersion)) |
|
| 44 | + { |
|
| 42 | 45 | return; |
| 43 | 46 | } |
| 44 | 47 | |
@@ -52,23 +55,28 @@ discard block |
||
| 52 | 55 | private function findMostRecentVersion(Version $version): ?string |
| 53 | 56 | { |
| 54 | 57 | $tags = []; |
| 55 | - foreach ($this->parser->parse($this->gitDirectory) as $tag) { |
|
| 58 | + foreach ($this->parser->parse($this->gitDirectory) as $tag) |
|
| 59 | + { |
|
| 56 | 60 | $tag = new Version(\strtolower($tag)); |
| 57 | 61 | |
| 58 | 62 | // all previous major versions |
| 59 | - if ($version->getMajor()->getValue() > $tag->getMajor()->getValue()) { |
|
| 63 | + if ($version->getMajor()->getValue() > $tag->getMajor()->getValue()) |
|
| 64 | + { |
|
| 60 | 65 | $tags[] = $tag; |
| 61 | 66 | } |
| 62 | 67 | |
| 63 | 68 | // all minor versions up to the requested in the requested major version |
| 64 | - if ($version->getMajor()->getValue() === $tag->getMajor()->getValue()) { |
|
| 65 | - if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue()) { |
|
| 69 | + if ($version->getMajor()->getValue() === $tag->getMajor()->getValue()) |
|
| 70 | + { |
|
| 71 | + if ($version->getMinor()->getValue() >= $tag->getMinor()->getValue()) |
|
| 72 | + { |
|
| 66 | 73 | $tags[] = $tag; |
| 67 | 74 | } |
| 68 | 75 | } |
| 69 | 76 | } |
| 70 | 77 | |
| 71 | - if ($tags === []) { |
|
| 78 | + if ($tags === []) |
|
| 79 | + { |
|
| 72 | 80 | return null; |
| 73 | 81 | } |
| 74 | 82 | |