@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | use Spiral\Core\Container\Autowire; |
13 | 13 | use Spiral\Debug\Dumper; |
14 | 14 | |
15 | -if (!function_exists('bind')) { |
|
15 | +if (!function_exists('bind')){ |
|
16 | 16 | /** |
17 | 17 | * Shortcut to container Autowire definition. |
18 | 18 | * |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | -if (!function_exists('dumprr')) { |
|
33 | +if (!function_exists('dumprr')){ |
|
34 | 34 | /** |
35 | 35 | * Dumprr is similar to Dump function but always redirect output to STDERR. |
36 | 36 | * |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | use Spiral\Core\Container\Autowire; |
13 | 13 | use Spiral\Debug\Dumper; |
14 | 14 | |
15 | -if (!function_exists('bind')) { |
|
15 | +if (!function_exists('bind')) |
|
16 | +{ |
|
16 | 17 | /** |
17 | 18 | * Shortcut to container Autowire definition. |
18 | 19 | * |
@@ -30,7 +31,8 @@ discard block |
||
30 | 31 | } |
31 | 32 | } |
32 | 33 | |
33 | -if (!function_exists('dumprr')) { |
|
34 | +if (!function_exists('dumprr')) |
|
35 | +{ |
|
34 | 36 | /** |
35 | 37 | * Dumprr is similar to Dump function but always redirect output to STDERR. |
36 | 38 | * |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function load(string $id): ?TokenInterface |
48 | 48 | { |
49 | - if (strpos($id, ':') === false) { |
|
49 | + if (strpos($id, ':') === false){ |
|
50 | 50 | return null; |
51 | 51 | } |
52 | 52 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** @var Token $token */ |
56 | 56 | $token = $this->orm->getRepository(Token::class)->findByPK($pk); |
57 | 57 | |
58 | - if ($token === null || !hash_equals($token->getHashedValue(), hash('sha512', $hash))) { |
|
58 | + if ($token === null || !hash_equals($token->getHashedValue(), hash('sha512', $hash))){ |
|
59 | 59 | // hijacked or deleted |
60 | 60 | return null; |
61 | 61 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $token->setSecretValue($hash); |
64 | 64 | |
65 | 65 | $expiresAt = $token->getExpiresAt(); |
66 | - if ($expiresAt !== null && $expiresAt < new DateTimeImmutable()) { |
|
66 | + if ($expiresAt !== null && $expiresAt < new DateTimeImmutable()){ |
|
67 | 67 | $this->delete($token); |
68 | 68 | return null; |
69 | 69 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function create(array $payload, DateTimeInterface $expiresAt = null): TokenInterface |
78 | 78 | { |
79 | - try { |
|
79 | + try{ |
|
80 | 80 | $token = new Token( |
81 | 81 | $this->issueID(), |
82 | 82 | $this->randomHash(128), |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $this->em->run(); |
90 | 90 | |
91 | 91 | return $token; |
92 | - } catch (Throwable $e) { |
|
92 | + }catch (Throwable $e){ |
|
93 | 93 | throw new TokenStorageException('Unable to create token', $e->getCode(), $e); |
94 | 94 | } |
95 | 95 | } |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function delete(TokenInterface $token): void |
101 | 101 | { |
102 | - try { |
|
102 | + try{ |
|
103 | 103 | $this->em->delete($token); |
104 | 104 | $this->em->run(); |
105 | - } catch (Throwable $e) { |
|
105 | + }catch (Throwable $e){ |
|
106 | 106 | throw new TokenStorageException('Unable to delete token', $e->getCode(), $e); |
107 | 107 | } |
108 | 108 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | ->select() |
123 | 123 | ->from($this->orm->getSource(Token::class)->getTable()); |
124 | 124 | |
125 | - while ((clone $query)->where('id', $id)->count('id') !== 0) { |
|
125 | + while ((clone $query)->where('id', $id)->count('id') !== 0){ |
|
126 | 126 | $id = $this->randomHash(64); |
127 | 127 | } |
128 | 128 |
@@ -46,7 +46,8 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function load(string $id): ?TokenInterface |
48 | 48 | { |
49 | - if (strpos($id, ':') === false) { |
|
49 | + if (strpos($id, ':') === false) |
|
50 | + { |
|
50 | 51 | return null; |
51 | 52 | } |
52 | 53 | |
@@ -55,7 +56,8 @@ discard block |
||
55 | 56 | /** @var Token $token */ |
56 | 57 | $token = $this->orm->getRepository(Token::class)->findByPK($pk); |
57 | 58 | |
58 | - if ($token === null || !hash_equals($token->getHashedValue(), hash('sha512', $hash))) { |
|
59 | + if ($token === null || !hash_equals($token->getHashedValue(), hash('sha512', $hash))) |
|
60 | + { |
|
59 | 61 | // hijacked or deleted |
60 | 62 | return null; |
61 | 63 | } |
@@ -63,7 +65,8 @@ discard block |
||
63 | 65 | $token->setSecretValue($hash); |
64 | 66 | |
65 | 67 | $expiresAt = $token->getExpiresAt(); |
66 | - if ($expiresAt !== null && $expiresAt < new DateTimeImmutable()) { |
|
68 | + if ($expiresAt !== null && $expiresAt < new DateTimeImmutable()) |
|
69 | + { |
|
67 | 70 | $this->delete($token); |
68 | 71 | return null; |
69 | 72 | } |
@@ -76,7 +79,8 @@ discard block |
||
76 | 79 | */ |
77 | 80 | public function create(array $payload, DateTimeInterface $expiresAt = null): TokenInterface |
78 | 81 | { |
79 | - try { |
|
82 | + try |
|
83 | + { |
|
80 | 84 | $token = new Token( |
81 | 85 | $this->issueID(), |
82 | 86 | $this->randomHash(128), |
@@ -89,7 +93,9 @@ discard block |
||
89 | 93 | $this->em->run(); |
90 | 94 | |
91 | 95 | return $token; |
92 | - } catch (Throwable $e) { |
|
96 | + } |
|
97 | + catch (Throwable $e) |
|
98 | + { |
|
93 | 99 | throw new TokenStorageException('Unable to create token', $e->getCode(), $e); |
94 | 100 | } |
95 | 101 | } |
@@ -99,10 +105,13 @@ discard block |
||
99 | 105 | */ |
100 | 106 | public function delete(TokenInterface $token): void |
101 | 107 | { |
102 | - try { |
|
108 | + try |
|
109 | + { |
|
103 | 110 | $this->em->delete($token); |
104 | 111 | $this->em->run(); |
105 | - } catch (Throwable $e) { |
|
112 | + } |
|
113 | + catch (Throwable $e) |
|
114 | + { |
|
106 | 115 | throw new TokenStorageException('Unable to delete token', $e->getCode(), $e); |
107 | 116 | } |
108 | 117 | } |
@@ -122,7 +131,8 @@ discard block |
||
122 | 131 | ->select() |
123 | 132 | ->from($this->orm->getSource(Token::class)->getTable()); |
124 | 133 | |
125 | - while ((clone $query)->where('id', $id)->count('id') !== 0) { |
|
134 | + while ((clone $query)->where('id', $id)->count('id') !== 0) |
|
135 | + { |
|
126 | 136 | $id = $this->randomHash(64); |
127 | 137 | } |
128 | 138 |
@@ -51,7 +51,7 @@ |
||
51 | 51 | array $payload, |
52 | 52 | DateTimeInterface $createdAt, |
53 | 53 | DateTimeInterface $expiresAt = null |
54 | - ) { |
|
54 | + ){ |
|
55 | 55 | $this->id = $id; |
56 | 56 | |
57 | 57 | $this->secretValue = $secretValue; |
@@ -43,23 +43,23 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function load(string $id): ?TokenInterface |
45 | 45 | { |
46 | - try { |
|
46 | + try{ |
|
47 | 47 | $tokenData = $this->session->getSection(self::SESSION_SECTION)->get('token'); |
48 | - if ($tokenData === null) { |
|
48 | + if ($tokenData === null){ |
|
49 | 49 | return null; |
50 | 50 | } |
51 | 51 | |
52 | 52 | $token = Token::unpack($tokenData); |
53 | - } catch (Throwable $e) { |
|
53 | + }catch (Throwable $e){ |
|
54 | 54 | throw new TokenStorageException('Unable to load session token', $e->getCode(), $e); |
55 | 55 | } |
56 | 56 | |
57 | - if (!hash_equals($token->getID(), $id)) { |
|
57 | + if (!hash_equals($token->getID(), $id)){ |
|
58 | 58 | return null; |
59 | 59 | } |
60 | 60 | |
61 | 61 | $expiresAt = $token->getExpiresAt(); |
62 | - if ($expiresAt !== null && $expiresAt < new DateTimeImmutable()) { |
|
62 | + if ($expiresAt !== null && $expiresAt < new DateTimeImmutable()){ |
|
63 | 63 | $this->delete($token); |
64 | 64 | return null; |
65 | 65 | } |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function create(array $payload, DateTimeInterface $expiresAt = null): TokenInterface |
74 | 74 | { |
75 | - try { |
|
75 | + try{ |
|
76 | 76 | $token = new Token($this->randomHash(128), $payload, $expiresAt); |
77 | 77 | $this->session->getSection(self::SESSION_SECTION)->set('token', $token->pack()); |
78 | 78 | |
79 | 79 | return $token; |
80 | - } catch (Throwable $e) { |
|
80 | + }catch (Throwable $e){ |
|
81 | 81 | throw new TokenStorageException('Unable to create session token', $e->getCode(), $e); |
82 | 82 | } |
83 | 83 | } |
@@ -43,23 +43,29 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function load(string $id): ?TokenInterface |
45 | 45 | { |
46 | - try { |
|
46 | + try |
|
47 | + { |
|
47 | 48 | $tokenData = $this->session->getSection(self::SESSION_SECTION)->get('token'); |
48 | - if ($tokenData === null) { |
|
49 | + if ($tokenData === null) |
|
50 | + { |
|
49 | 51 | return null; |
50 | 52 | } |
51 | 53 | |
52 | 54 | $token = Token::unpack($tokenData); |
53 | - } catch (Throwable $e) { |
|
55 | + } |
|
56 | + catch (Throwable $e) |
|
57 | + { |
|
54 | 58 | throw new TokenStorageException('Unable to load session token', $e->getCode(), $e); |
55 | 59 | } |
56 | 60 | |
57 | - if (!hash_equals($token->getID(), $id)) { |
|
61 | + if (!hash_equals($token->getID(), $id)) |
|
62 | + { |
|
58 | 63 | return null; |
59 | 64 | } |
60 | 65 | |
61 | 66 | $expiresAt = $token->getExpiresAt(); |
62 | - if ($expiresAt !== null && $expiresAt < new DateTimeImmutable()) { |
|
67 | + if ($expiresAt !== null && $expiresAt < new DateTimeImmutable()) |
|
68 | + { |
|
63 | 69 | $this->delete($token); |
64 | 70 | return null; |
65 | 71 | } |
@@ -72,12 +78,15 @@ discard block |
||
72 | 78 | */ |
73 | 79 | public function create(array $payload, DateTimeInterface $expiresAt = null): TokenInterface |
74 | 80 | { |
75 | - try { |
|
81 | + try |
|
82 | + { |
|
76 | 83 | $token = new Token($this->randomHash(128), $payload, $expiresAt); |
77 | 84 | $this->session->getSection(self::SESSION_SECTION)->set('token', $token->pack()); |
78 | 85 | |
79 | 86 | return $token; |
80 | - } catch (Throwable $e) { |
|
87 | + } |
|
88 | + catch (Throwable $e) |
|
89 | + { |
|
81 | 90 | throw new TokenStorageException('Unable to create session token', $e->getCode(), $e); |
82 | 91 | } |
83 | 92 | } |
@@ -87,7 +87,7 @@ |
||
87 | 87 | public static function unpack(array $data): Token |
88 | 88 | { |
89 | 89 | $expiresAt = null; |
90 | - if ($data['expiresAt'] !== null) { |
|
90 | + if ($data['expiresAt'] !== null){ |
|
91 | 91 | $expiresAt = (new DateTimeImmutable())->setTimestamp($data['expiresAt']); |
92 | 92 | } |
93 | 93 |
@@ -87,7 +87,8 @@ |
||
87 | 87 | public static function unpack(array $data): Token |
88 | 88 | { |
89 | 89 | $expiresAt = null; |
90 | - if ($data['expiresAt'] !== null) { |
|
90 | + if ($data['expiresAt'] !== null) |
|
91 | + { |
|
91 | 92 | $expiresAt = (new DateTimeImmutable())->setTimestamp($data['expiresAt']); |
92 | 93 | } |
93 | 94 |
@@ -42,13 +42,13 @@ |
||
42 | 42 | { |
43 | 43 | $schema = $this->orm->getSchema(); |
44 | 44 | |
45 | - foreach ($schema->getRoles() as $role) { |
|
45 | + foreach ($schema->getRoles() as $role){ |
|
46 | 46 | $repository = $schema->define($role, Schema::REPOSITORY); |
47 | 47 | |
48 | 48 | if ( |
49 | 49 | $repository !== Select\Repository::class |
50 | 50 | && $repository === $class->getName() |
51 | - ) { |
|
51 | + ){ |
|
52 | 52 | return $this->orm->getRepository($role); |
53 | 53 | } |
54 | 54 | } |
@@ -42,7 +42,8 @@ |
||
42 | 42 | { |
43 | 43 | $schema = $this->orm->getSchema(); |
44 | 44 | |
45 | - foreach ($schema->getRoles() as $role) { |
|
45 | + foreach ($schema->getRoles() as $role) |
|
46 | + { |
|
46 | 47 | $repository = $schema->define($role, Schema::REPOSITORY); |
47 | 48 | |
48 | 49 | if ( |
@@ -43,29 +43,29 @@ |
||
43 | 43 | */ |
44 | 44 | protected function mapDirectories(array $directories): array |
45 | 45 | { |
46 | - if (!isset($directories['root'])) { |
|
46 | + if (!isset($directories['root'])){ |
|
47 | 47 | throw new BootException('Missing required directory `root`'); |
48 | 48 | } |
49 | 49 | |
50 | - if (!isset($directories['app'])) { |
|
51 | - $directories['app'] = $directories['root'] . '/app/'; |
|
50 | + if (!isset($directories['app'])){ |
|
51 | + $directories['app'] = $directories['root'].'/app/'; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | return array_merge( |
55 | 55 | [ |
56 | 56 | // public root |
57 | - 'public' => $directories['root'] . '/public/', |
|
57 | + 'public' => $directories['root'].'/public/', |
|
58 | 58 | |
59 | 59 | // vendor libraries |
60 | - 'vendor' => $directories['root'] . '/vendor/', |
|
60 | + 'vendor' => $directories['root'].'/vendor/', |
|
61 | 61 | |
62 | 62 | // data directories |
63 | - 'runtime' => $directories['root'] . '/runtime/', |
|
64 | - 'cache' => $directories['root'] . '/runtime/cache/', |
|
63 | + 'runtime' => $directories['root'].'/runtime/', |
|
64 | + 'cache' => $directories['root'].'/runtime/cache/', |
|
65 | 65 | |
66 | 66 | // application directories |
67 | - 'config' => $directories['app'] . '/config/', |
|
68 | - 'resources' => $directories['app'] . '/resources/', |
|
67 | + 'config' => $directories['app'].'/config/', |
|
68 | + 'resources' => $directories['app'].'/resources/', |
|
69 | 69 | ], |
70 | 70 | $directories |
71 | 71 | ); |
@@ -43,11 +43,13 @@ |
||
43 | 43 | */ |
44 | 44 | protected function mapDirectories(array $directories): array |
45 | 45 | { |
46 | - if (!isset($directories['root'])) { |
|
46 | + if (!isset($directories['root'])) |
|
47 | + { |
|
47 | 48 | throw new BootException('Missing required directory `root`'); |
48 | 49 | } |
49 | 50 | |
50 | - if (!isset($directories['app'])) { |
|
51 | + if (!isset($directories['app'])) |
|
52 | + { |
|
51 | 53 | $directories['app'] = $directories['root'] . '/app/'; |
52 | 54 | } |
53 | 55 |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | { |
43 | 43 | $grid = $this->table(['Verbs:', 'Pattern:', 'Target:']); |
44 | 44 | |
45 | - foreach ($router->getRoutes() as $route) { |
|
46 | - if ($route instanceof Route) { |
|
45 | + foreach ($router->getRoutes() as $route){ |
|
46 | + if ($route instanceof Route){ |
|
47 | 47 | $grid->addRow( |
48 | 48 | [ |
49 | 49 | $this->getVerbs($route), |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | */ |
64 | 64 | private function getVerbs(Route $route): string |
65 | 65 | { |
66 | - if ($route->getVerbs() === Route::VERBS) { |
|
66 | + if ($route->getVerbs() === Route::VERBS){ |
|
67 | 67 | return '*'; |
68 | 68 | } |
69 | 69 | |
70 | 70 | $result = []; |
71 | 71 | |
72 | - foreach ($route->getVerbs() as $verb) { |
|
73 | - switch (strtolower($verb)) { |
|
72 | + foreach ($route->getVerbs() as $verb){ |
|
73 | + switch (strtolower($verb)){ |
|
74 | 74 | case 'get': |
75 | 75 | $verb = '<fg=green>GET</>'; |
76 | 76 | break; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | return preg_replace_callback( |
108 | 108 | '/<([^>]*)>/', |
109 | - static function ($m) { |
|
109 | + static function ($m){ |
|
110 | 110 | return sprintf('<fg=magenta>%s</>', $m[0]); |
111 | 111 | }, |
112 | 112 | $pattern |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | private function getTarget(Route $route, KernelInterface $kernel): string |
124 | 124 | { |
125 | 125 | $target = $this->getValue($route, 'target'); |
126 | - switch (true) { |
|
126 | + switch (true){ |
|
127 | 127 | case $target instanceof Closure: |
128 | 128 | $reflection = new ReflectionFunction($target); |
129 | 129 | return sprintf( |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | case $target instanceof Group: |
149 | 149 | $result = []; |
150 | - foreach ($this->getValue($target, 'controllers') as $alias => $class) { |
|
150 | + foreach ($this->getValue($target, 'controllers') as $alias => $class){ |
|
151 | 151 | $result[] = sprintf('%s => %s', $alias, $this->relativeClass($class, $kernel)); |
152 | 152 | } |
153 | 153 | |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | */ |
172 | 172 | private function getValue(object $object, string $property) |
173 | 173 | { |
174 | - try { |
|
174 | + try{ |
|
175 | 175 | $r = new ReflectionObject($object); |
176 | 176 | $prop = $r->getProperty($property); |
177 | 177 | $prop->setAccessible(true); |
178 | - } catch (Throwable $e) { |
|
178 | + }catch (Throwable $e){ |
|
179 | 179 | return $e->getMessage(); |
180 | 180 | } |
181 | 181 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $r = new ReflectionObject($kernel); |
193 | 193 | $r->getNamespaceName(); |
194 | 194 | |
195 | - if (strpos($class, $r->getNamespaceName()) === 0) { |
|
195 | + if (strpos($class, $r->getNamespaceName()) === 0){ |
|
196 | 196 | return substr($class, strlen($r->getNamespaceName()) + 1); |
197 | 197 | } |
198 | 198 |
@@ -42,8 +42,10 @@ discard block |
||
42 | 42 | { |
43 | 43 | $grid = $this->table(['Verbs:', 'Pattern:', 'Target:']); |
44 | 44 | |
45 | - foreach ($router->getRoutes() as $route) { |
|
46 | - if ($route instanceof Route) { |
|
45 | + foreach ($router->getRoutes() as $route) |
|
46 | + { |
|
47 | + if ($route instanceof Route) |
|
48 | + { |
|
47 | 49 | $grid->addRow( |
48 | 50 | [ |
49 | 51 | $this->getVerbs($route), |
@@ -63,14 +65,17 @@ discard block |
||
63 | 65 | */ |
64 | 66 | private function getVerbs(Route $route): string |
65 | 67 | { |
66 | - if ($route->getVerbs() === Route::VERBS) { |
|
68 | + if ($route->getVerbs() === Route::VERBS) |
|
69 | + { |
|
67 | 70 | return '*'; |
68 | 71 | } |
69 | 72 | |
70 | 73 | $result = []; |
71 | 74 | |
72 | - foreach ($route->getVerbs() as $verb) { |
|
73 | - switch (strtolower($verb)) { |
|
75 | + foreach ($route->getVerbs() as $verb) |
|
76 | + { |
|
77 | + switch (strtolower($verb)) |
|
78 | + { |
|
74 | 79 | case 'get': |
75 | 80 | $verb = '<fg=green>GET</>'; |
76 | 81 | break; |
@@ -106,7 +111,8 @@ discard block |
||
106 | 111 | |
107 | 112 | return preg_replace_callback( |
108 | 113 | '/<([^>]*)>/', |
109 | - static function ($m) { |
|
114 | + static function ($m) |
|
115 | + { |
|
110 | 116 | return sprintf('<fg=magenta>%s</>', $m[0]); |
111 | 117 | }, |
112 | 118 | $pattern |
@@ -123,7 +129,8 @@ discard block |
||
123 | 129 | private function getTarget(Route $route, KernelInterface $kernel): string |
124 | 130 | { |
125 | 131 | $target = $this->getValue($route, 'target'); |
126 | - switch (true) { |
|
132 | + switch (true) |
|
133 | + { |
|
127 | 134 | case $target instanceof Closure: |
128 | 135 | $reflection = new ReflectionFunction($target); |
129 | 136 | return sprintf( |
@@ -147,7 +154,8 @@ discard block |
||
147 | 154 | |
148 | 155 | case $target instanceof Group: |
149 | 156 | $result = []; |
150 | - foreach ($this->getValue($target, 'controllers') as $alias => $class) { |
|
157 | + foreach ($this->getValue($target, 'controllers') as $alias => $class) |
|
158 | + { |
|
151 | 159 | $result[] = sprintf('%s => %s', $alias, $this->relativeClass($class, $kernel)); |
152 | 160 | } |
153 | 161 | |
@@ -171,11 +179,14 @@ discard block |
||
171 | 179 | */ |
172 | 180 | private function getValue(object $object, string $property) |
173 | 181 | { |
174 | - try { |
|
182 | + try |
|
183 | + { |
|
175 | 184 | $r = new ReflectionObject($object); |
176 | 185 | $prop = $r->getProperty($property); |
177 | 186 | $prop->setAccessible(true); |
178 | - } catch (Throwable $e) { |
|
187 | + } |
|
188 | + catch (Throwable $e) |
|
189 | + { |
|
179 | 190 | return $e->getMessage(); |
180 | 191 | } |
181 | 192 | |
@@ -192,7 +203,8 @@ discard block |
||
192 | 203 | $r = new ReflectionObject($kernel); |
193 | 204 | $r->getNamespaceName(); |
194 | 205 | |
195 | - if (strpos($class, $r->getNamespaceName()) === 0) { |
|
206 | + if (strpos($class, $r->getNamespaceName()) === 0) |
|
207 | + { |
|
196 | 208 | return substr($class, strlen($r->getNamespaceName()) + 1); |
197 | 209 | } |
198 | 210 |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function __invoke(LogEvent $event): void |
53 | 53 | { |
54 | - if (empty($this->output)) { |
|
54 | + if (empty($this->output)){ |
|
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | - if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) { |
|
58 | + if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE){ |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function enable(): self |
95 | 95 | { |
96 | - if (!empty($this->listenerRegistry)) { |
|
96 | + if (!empty($this->listenerRegistry)){ |
|
97 | 97 | $this->listenerRegistry->addListener($this); |
98 | 98 | } |
99 | 99 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function disable(): self |
109 | 109 | { |
110 | - if (!empty($this->listenerRegistry)) { |
|
110 | + if (!empty($this->listenerRegistry)){ |
|
111 | 111 | $this->listenerRegistry->removeListener($this); |
112 | 112 | } |
113 | 113 | |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | */ |
131 | 131 | private function getChannel(string $channel): string |
132 | 132 | { |
133 | - if (!class_exists($channel, false)) { |
|
133 | + if (!class_exists($channel, false)){ |
|
134 | 134 | return "[{$channel}]"; |
135 | 135 | } |
136 | 136 | |
137 | - try { |
|
137 | + try{ |
|
138 | 138 | $reflection = new \ReflectionClass($channel); |
139 | - } catch (\ReflectionException $e) { |
|
139 | + }catch (\ReflectionException $e){ |
|
140 | 140 | return $channel; |
141 | 141 | } |
142 | 142 | |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | */ |
151 | 151 | private function getMessage(bool $decorated, string $message): string |
152 | 152 | { |
153 | - if (!$decorated) { |
|
153 | + if (!$decorated){ |
|
154 | 154 | return $message; |
155 | 155 | } |
156 | 156 | |
157 | - return Color::GRAY . $message . Color::RESET; |
|
157 | + return Color::GRAY.$message.Color::RESET; |
|
158 | 158 | } |
159 | 159 | } |
@@ -51,11 +51,13 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function __invoke(LogEvent $event): void |
53 | 53 | { |
54 | - if (empty($this->output)) { |
|
54 | + if (empty($this->output)) |
|
55 | + { |
|
55 | 56 | return; |
56 | 57 | } |
57 | 58 | |
58 | - if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) { |
|
59 | + if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) |
|
60 | + { |
|
59 | 61 | return; |
60 | 62 | } |
61 | 63 | |
@@ -93,7 +95,8 @@ discard block |
||
93 | 95 | */ |
94 | 96 | public function enable(): self |
95 | 97 | { |
96 | - if (!empty($this->listenerRegistry)) { |
|
98 | + if (!empty($this->listenerRegistry)) |
|
99 | + { |
|
97 | 100 | $this->listenerRegistry->addListener($this); |
98 | 101 | } |
99 | 102 | |
@@ -107,7 +110,8 @@ discard block |
||
107 | 110 | */ |
108 | 111 | public function disable(): self |
109 | 112 | { |
110 | - if (!empty($this->listenerRegistry)) { |
|
113 | + if (!empty($this->listenerRegistry)) |
|
114 | + { |
|
111 | 115 | $this->listenerRegistry->removeListener($this); |
112 | 116 | } |
113 | 117 | |
@@ -130,13 +134,17 @@ discard block |
||
130 | 134 | */ |
131 | 135 | private function getChannel(string $channel): string |
132 | 136 | { |
133 | - if (!class_exists($channel, false)) { |
|
137 | + if (!class_exists($channel, false)) |
|
138 | + { |
|
134 | 139 | return "[{$channel}]"; |
135 | 140 | } |
136 | 141 | |
137 | - try { |
|
142 | + try |
|
143 | + { |
|
138 | 144 | $reflection = new \ReflectionClass($channel); |
139 | - } catch (\ReflectionException $e) { |
|
145 | + } |
|
146 | + catch (\ReflectionException $e) |
|
147 | + { |
|
140 | 148 | return $channel; |
141 | 149 | } |
142 | 150 | |
@@ -150,7 +158,8 @@ discard block |
||
150 | 158 | */ |
151 | 159 | private function getMessage(bool $decorated, string $message): string |
152 | 160 | { |
153 | - if (!$decorated) { |
|
161 | + if (!$decorated) |
|
162 | + { |
|
154 | 163 | return $message; |
155 | 164 | } |
156 | 165 |