@@ -68,11 +68,11 @@ |
||
68 | 68 | */ |
69 | 69 | public function getActor(): ?object |
70 | 70 | { |
71 | - if ($this->closed) { |
|
71 | + if ($this->closed){ |
|
72 | 72 | return null; |
73 | 73 | } |
74 | 74 | |
75 | - if ($this->actor === null && $this->token !== null) { |
|
75 | + if ($this->actor === null && $this->token !== null){ |
|
76 | 76 | $this->actor = $this->actorProvider->getActor($this->token); |
77 | 77 | } |
78 | 78 |
@@ -68,11 +68,13 @@ |
||
68 | 68 | */ |
69 | 69 | public function getActor(): ?object |
70 | 70 | { |
71 | - if ($this->closed) { |
|
71 | + if ($this->closed) |
|
72 | + { |
|
72 | 73 | return null; |
73 | 74 | } |
74 | 75 | |
75 | - if ($this->actor === null && $this->token !== null) { |
|
76 | + if ($this->actor === null && $this->token !== null) |
|
77 | + { |
|
76 | 78 | $this->actor = $this->actorProvider->getActor($this->token); |
77 | 79 | } |
78 | 80 |
@@ -89,7 +89,8 @@ discard block |
||
89 | 89 | { |
90 | 90 | $d = $this->makeDumper(); |
91 | 91 | |
92 | - $result = $d->dump(new class() { |
|
92 | + $result = $d->dump(new class() |
|
93 | + { |
|
93 | 94 | private $name = 'Test'; |
94 | 95 | }, Dumper::RETURN); |
95 | 96 | |
@@ -151,7 +152,8 @@ discard block |
||
151 | 152 | public function testDebugInfo(): void |
152 | 153 | { |
153 | 154 | $d = $this->makeDumper(); |
154 | - $result = $d->dump(new class() { |
|
155 | + $result = $d->dump(new class() |
|
156 | + { |
|
155 | 157 | protected $inner = '_kk_'; |
156 | 158 | |
157 | 159 | public function __debugInfo() |
@@ -171,7 +173,8 @@ discard block |
||
171 | 173 | public function testinternal(): void |
172 | 174 | { |
173 | 175 | $d = $this->makeDumper(); |
174 | - $result = $d->dump(new class() { |
|
176 | + $result = $d->dump(new class() |
|
177 | + { |
|
175 | 178 | protected $visible = '_kk_'; |
176 | 179 | |
177 | 180 | /** @internal */ |
@@ -198,7 +201,8 @@ discard block |
||
198 | 201 | $d = $this->makeDumper(); |
199 | 202 | $d->setRenderer(Dumper::RETURN, new HtmlRenderer()); |
200 | 203 | |
201 | - $result = $d->dump(new class() { |
|
204 | + $result = $d->dump(new class() |
|
205 | + { |
|
202 | 206 | protected static $static = 'yes'; |
203 | 207 | |
204 | 208 | private $value = 123; |
@@ -222,7 +226,8 @@ discard block |
||
222 | 226 | $d->setRenderer(Dumper::RETURN, new HtmlRenderer(HtmlRenderer::INVERTED)); |
223 | 227 | $d->setMaxLevel(5); |
224 | 228 | |
225 | - $result = $d->dump(new class() { |
|
229 | + $result = $d->dump(new class() |
|
230 | + { |
|
226 | 231 | private $value = 123; |
227 | 232 | |
228 | 233 | protected $visible = '_kk_'; |
@@ -246,7 +251,8 @@ discard block |
||
246 | 251 | $d->setRenderer(Dumper::RETURN, new ConsoleRenderer()); |
247 | 252 | $d->setMaxLevel(5); |
248 | 253 | |
249 | - $result = $d->dump(new class() { |
|
254 | + $result = $d->dump(new class() |
|
255 | + { |
|
250 | 256 | private $value = 123; |
251 | 257 | |
252 | 258 | protected $visible = '_kk_'; |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | $d->dump(1); |
30 | 30 | $result = ob_get_clean(); |
31 | 31 | |
32 | - $this->assertSame($d->dump(1, Dumper::RETURN), $result); |
|
32 | + $this->assertSame($d->dump(1, Dumper::return), $result); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | private function makeDumper(LoggerInterface $logger = null) |
36 | 36 | { |
37 | 37 | $d = new Dumper($logger); |
38 | 38 | $d->setRenderer(Dumper::OUTPUT, new PlainRenderer()); |
39 | - $d->setRenderer(Dumper::RETURN, new PlainRenderer()); |
|
39 | + $d->setRenderer(Dumper::return, new PlainRenderer()); |
|
40 | 40 | $d->setRenderer(Dumper::OUTPUT_CLI_COLORS, new PlainRenderer()); |
41 | 41 | |
42 | 42 | return $d; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function testScalar(): void |
46 | 46 | { |
47 | 47 | $d = $this->makeDumper(); |
48 | - $result = $d->dump(123, Dumper::RETURN); |
|
48 | + $result = $d->dump(123, Dumper::return); |
|
49 | 49 | |
50 | 50 | $this->assertStringContainsString('123', $result); |
51 | 51 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public function testString(): void |
54 | 54 | { |
55 | 55 | $d = $this->makeDumper(); |
56 | - $result = $d->dump('hello world', Dumper::RETURN); |
|
56 | + $result = $d->dump('hello world', Dumper::return); |
|
57 | 57 | |
58 | 58 | $this->assertStringContainsString('hello world', $result); |
59 | 59 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public function testResource(): void |
62 | 62 | { |
63 | 63 | $d = $this->makeDumper(); |
64 | - $result = $d->dump(STDOUT, Dumper::RETURN); |
|
64 | + $result = $d->dump(STDOUT, Dumper::return); |
|
65 | 65 | |
66 | 66 | $this->assertStringContainsString('resource', $result); |
67 | 67 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public function testHTML(): void |
70 | 70 | { |
71 | 71 | $d = $this->makeDumper(); |
72 | - $result = $d->dump('hello <br/>world', Dumper::RETURN); |
|
72 | + $result = $d->dump('hello <br/>world', Dumper::return); |
|
73 | 73 | |
74 | 74 | $this->assertStringContainsString('hello <br/>world', $result); |
75 | 75 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | public function testArray(): void |
78 | 78 | { |
79 | 79 | $d = $this->makeDumper(); |
80 | - $result = $d->dump(['G', 'B', 'N'], Dumper::RETURN); |
|
80 | + $result = $d->dump(['G', 'B', 'N'], Dumper::return); |
|
81 | 81 | |
82 | 82 | $this->assertStringContainsString('array', $result); |
83 | 83 | $this->assertStringContainsString('G', $result); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $result = $d->dump(new class() { |
93 | 93 | private $name = 'Test'; |
94 | - }, Dumper::RETURN); |
|
94 | + }, Dumper::return); |
|
95 | 95 | |
96 | 96 | $this->assertStringContainsString('object', $result); |
97 | 97 | $this->assertStringContainsString('private', $result); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | $result = $d->dump(static function (): void { |
108 | 108 | echo 'hello world'; |
109 | - }, Dumper::RETURN); |
|
109 | + }, Dumper::return); |
|
110 | 110 | |
111 | 111 | $this->assertStringContainsString('Closure', $result); |
112 | 112 | $this->assertStringContainsString('DumperTest.php', $result); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $mock = $this->createMock(LoggerInterface::class); |
118 | 118 | $d = $this->makeDumper($mock); |
119 | 119 | |
120 | - $mock->method('debug')->with($d->dump('abc', Dumper::RETURN)); |
|
120 | + $mock->method('debug')->with($d->dump('abc', Dumper::return)); |
|
121 | 121 | $this->assertNull($d->dump('abc', Dumper::LOGGER)); |
122 | 122 | } |
123 | 123 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | '_magic_' => '_value_', |
161 | 161 | ]; |
162 | 162 | } |
163 | - }, Dumper::RETURN); |
|
163 | + }, Dumper::return); |
|
164 | 164 | |
165 | 165 | $this->assertStringContainsString('_magic_', $result); |
166 | 166 | $this->assertStringContainsString('_value_', $result); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | /** @internal */ |
178 | 178 | protected $internal = '_ok_'; |
179 | - }, Dumper::RETURN); |
|
179 | + }, Dumper::return); |
|
180 | 180 | |
181 | 181 | $this->assertStringContainsString('visible', $result); |
182 | 182 | $this->assertStringContainsString('_kk_', $result); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | public function testHtmlRenderer(): void |
197 | 197 | { |
198 | 198 | $d = $this->makeDumper(); |
199 | - $d->setRenderer(Dumper::RETURN, new HtmlRenderer()); |
|
199 | + $d->setRenderer(Dumper::return, new HtmlRenderer()); |
|
200 | 200 | |
201 | 201 | $result = $d->dump(new class() { |
202 | 202 | protected static $static = 'yes'; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | /** @internal */ |
209 | 209 | protected $internal = '_ok_'; |
210 | - }, Dumper::RETURN); |
|
210 | + }, Dumper::return); |
|
211 | 211 | |
212 | 212 | $this->assertStringContainsString('visible', $result); |
213 | 213 | $this->assertStringContainsString('_kk_', $result); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | public function testInvertedRenderer(): void |
220 | 220 | { |
221 | 221 | $d = $this->makeDumper(); |
222 | - $d->setRenderer(Dumper::RETURN, new HtmlRenderer(HtmlRenderer::INVERTED)); |
|
222 | + $d->setRenderer(Dumper::return, new HtmlRenderer(HtmlRenderer::INVERTED)); |
|
223 | 223 | $d->setMaxLevel(5); |
224 | 224 | |
225 | 225 | $result = $d->dump(new class() { |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | /** @internal */ |
233 | 233 | protected $internal = '_ok_'; |
234 | - }, Dumper::RETURN); |
|
234 | + }, Dumper::return); |
|
235 | 235 | |
236 | 236 | $this->assertStringContainsString('visible', $result); |
237 | 237 | $this->assertStringContainsString('_kk_', $result); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | public function testConsoleRenderer(): void |
244 | 244 | { |
245 | 245 | $d = $this->makeDumper(); |
246 | - $d->setRenderer(Dumper::RETURN, new ConsoleRenderer()); |
|
246 | + $d->setRenderer(Dumper::return, new ConsoleRenderer()); |
|
247 | 247 | $d->setMaxLevel(5); |
248 | 248 | |
249 | 249 | $result = $d->dump(new class() { |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | /** @internal */ |
257 | 257 | protected $internal = '_ok_'; |
258 | - }, Dumper::RETURN); |
|
258 | + }, Dumper::return); |
|
259 | 259 | |
260 | 260 | $this->assertStringContainsString('visible', $result); |
261 | 261 | $this->assertStringContainsString('_kk_', $result); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @var string |
25 | 25 | */ |
26 | - protected $element = '%s%s' . Color::RESET; |
|
26 | + protected $element = '%s%s'.Color::RESET; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Set of styles associated with different dumping properties. |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function apply($element, string $type, string $context = ''): string |
64 | 64 | { |
65 | - if (!empty($style = $this->getStyle($type, $context))) { |
|
65 | + if (!empty($style = $this->getStyle($type, $context))){ |
|
66 | 66 | return sprintf($this->element, $style, $element); |
67 | 67 | } |
68 | 68 | |
@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | */ |
88 | 88 | private function getStyle(string $type, string $context): string |
89 | 89 | { |
90 | - if (isset($this->styles[$type][$context])) { |
|
90 | + if (isset($this->styles[$type][$context])){ |
|
91 | 91 | return $this->styles[$type][$context]; |
92 | 92 | } |
93 | 93 | |
94 | - if (isset($this->styles[$type]['common'])) { |
|
94 | + if (isset($this->styles[$type]['common'])){ |
|
95 | 95 | return $this->styles[$type]['common']; |
96 | 96 | } |
97 | 97 | |
98 | - if (isset($this->styles[$type]) && is_string($this->styles[$type])) { |
|
98 | + if (isset($this->styles[$type]) && is_string($this->styles[$type])){ |
|
99 | 99 | return $this->styles[$type]; |
100 | 100 | } |
101 | 101 |
@@ -62,7 +62,8 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function apply($element, string $type, string $context = ''): string |
64 | 64 | { |
65 | - if (!empty($style = $this->getStyle($type, $context))) { |
|
65 | + if (!empty($style = $this->getStyle($type, $context))) |
|
66 | + { |
|
66 | 67 | return sprintf($this->element, $style, $element); |
67 | 68 | } |
68 | 69 | |
@@ -87,15 +88,18 @@ discard block |
||
87 | 88 | */ |
88 | 89 | private function getStyle(string $type, string $context): string |
89 | 90 | { |
90 | - if (isset($this->styles[$type][$context])) { |
|
91 | + if (isset($this->styles[$type][$context])) |
|
92 | + { |
|
91 | 93 | return $this->styles[$type][$context]; |
92 | 94 | } |
93 | 95 | |
94 | - if (isset($this->styles[$type]['common'])) { |
|
96 | + if (isset($this->styles[$type]['common'])) |
|
97 | + { |
|
95 | 98 | return $this->styles[$type]['common']; |
96 | 99 | } |
97 | 100 | |
98 | - if (isset($this->styles[$type]) && is_string($this->styles[$type])) { |
|
101 | + if (isset($this->styles[$type]) && is_string($this->styles[$type])) |
|
102 | + { |
|
99 | 103 | return $this->styles[$type]; |
100 | 104 | } |
101 | 105 |
@@ -42,7 +42,7 @@ |
||
42 | 42 | */ |
43 | 43 | public function indent(int $level): string |
44 | 44 | { |
45 | - if ($level == 0) { |
|
45 | + if ($level == 0){ |
|
46 | 46 | return ''; |
47 | 47 | } |
48 | 48 |
@@ -42,7 +42,8 @@ |
||
42 | 42 | */ |
43 | 43 | public function indent(int $level): string |
44 | 44 | { |
45 | - if ($level == 0) { |
|
45 | + if ($level == 0) |
|
46 | + { |
|
46 | 47 | return ''; |
47 | 48 | } |
48 | 49 |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $context |
56 | 56 | ); |
57 | 57 | |
58 | - foreach ($this->listenedRegistry->getListeners() as $listener) { |
|
58 | + foreach ($this->listenedRegistry->getListeners() as $listener){ |
|
59 | 59 | call_user_func($listener, $e); |
60 | 60 | } |
61 | 61 | } |
@@ -55,7 +55,8 @@ |
||
55 | 55 | $context |
56 | 56 | ); |
57 | 57 | |
58 | - foreach ($this->listenedRegistry->getListeners() as $listener) { |
|
58 | + foreach ($this->listenedRegistry->getListeners() as $listener) |
|
59 | + { |
|
59 | 60 | call_user_func($listener, $e); |
60 | 61 | } |
61 | 62 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | string $level, |
42 | 42 | string $message, |
43 | 43 | array $context = [] |
44 | - ) { |
|
44 | + ){ |
|
45 | 45 | $this->time = $time; |
46 | 46 | $this->channel = $channel; |
47 | 47 | $this->level = $level; |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | */ |
43 | 43 | protected function getLogger(string $channel = null): LoggerInterface |
44 | 44 | { |
45 | - if ($channel !== null) { |
|
45 | + if ($channel !== null){ |
|
46 | 46 | return $this->allocateLogger($channel); |
47 | 47 | } |
48 | 48 | |
49 | - if ($this->logger !== null) { |
|
49 | + if ($this->logger !== null){ |
|
50 | 50 | return $this->logger; |
51 | 51 | } |
52 | 52 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | private function allocateLogger(string $channel): LoggerInterface |
64 | 64 | { |
65 | 65 | $container = ContainerScope::getContainer(); |
66 | - if (empty($container) || !$container->has(LogsInterface::class)) { |
|
66 | + if (empty($container) || !$container->has(LogsInterface::class)){ |
|
67 | 67 | return $this->logger ?? new NullLogger(); |
68 | 68 | } |
69 | 69 |
@@ -42,11 +42,13 @@ discard block |
||
42 | 42 | */ |
43 | 43 | protected function getLogger(string $channel = null): LoggerInterface |
44 | 44 | { |
45 | - if ($channel !== null) { |
|
45 | + if ($channel !== null) |
|
46 | + { |
|
46 | 47 | return $this->allocateLogger($channel); |
47 | 48 | } |
48 | 49 | |
49 | - if ($this->logger !== null) { |
|
50 | + if ($this->logger !== null) |
|
51 | + { |
|
50 | 52 | return $this->logger; |
51 | 53 | } |
52 | 54 | |
@@ -63,7 +65,8 @@ discard block |
||
63 | 65 | private function allocateLogger(string $channel): LoggerInterface |
64 | 66 | { |
65 | 67 | $container = ContainerScope::getContainer(); |
66 | - if (empty($container) || !$container->has(LogsInterface::class)) { |
|
68 | + if (empty($container) || !$container->has(LogsInterface::class)) |
|
69 | + { |
|
67 | 70 | return $this->logger ?? new NullLogger(); |
68 | 71 | } |
69 | 72 |
@@ -34,8 +34,8 @@ |
||
34 | 34 | public function setTags(array $tags): void |
35 | 35 | { |
36 | 36 | $setTags = []; |
37 | - foreach ($tags as $key => $value) { |
|
38 | - if (!is_string($value)) { |
|
37 | + foreach ($tags as $key => $value){ |
|
38 | + if (!is_string($value)){ |
|
39 | 39 | throw new StateException(sprintf( |
40 | 40 | 'Invalid tag value, string expected got %s', |
41 | 41 | is_object($value) ? get_class($value) : gettype($value) |
@@ -34,8 +34,10 @@ |
||
34 | 34 | public function setTags(array $tags): void |
35 | 35 | { |
36 | 36 | $setTags = []; |
37 | - foreach ($tags as $key => $value) { |
|
38 | - if (!is_string($value)) { |
|
37 | + foreach ($tags as $key => $value) |
|
38 | + { |
|
39 | + if (!is_string($value)) |
|
40 | + { |
|
39 | 41 | throw new StateException(sprintf( |
40 | 42 | 'Invalid tag value, string expected got %s', |
41 | 43 | is_object($value) ? get_class($value) : gettype($value) |
@@ -21,17 +21,17 @@ discard block |
||
21 | 21 | { |
22 | 22 | $core = TestCore::init([ |
23 | 23 | 'root' => __DIR__, |
24 | - 'cache' => __DIR__ . '/cache' |
|
24 | + 'cache' => __DIR__.'/cache' |
|
25 | 25 | ]); |
26 | 26 | |
27 | 27 | /** @var MemoryInterface $memory */ |
28 | 28 | $memory = $core->getContainer()->get(MemoryInterface::class); |
29 | 29 | |
30 | 30 | $memory->saveData('test', 'data'); |
31 | - $this->assertFileExists(__DIR__ . '/cache/test.php'); |
|
31 | + $this->assertFileExists(__DIR__.'/cache/test.php'); |
|
32 | 32 | $this->assertSame('data', $memory->loadData('test')); |
33 | 33 | |
34 | - unlink(__DIR__ . '/cache/test.php'); |
|
34 | + unlink(__DIR__.'/cache/test.php'); |
|
35 | 35 | $this->assertNull($memory->loadData('test')); |
36 | 36 | } |
37 | 37 | |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | { |
40 | 40 | $core = TestCore::init([ |
41 | 41 | 'root' => __DIR__, |
42 | - 'cache' => __DIR__ . '/cache' |
|
42 | + 'cache' => __DIR__.'/cache' |
|
43 | 43 | ]); |
44 | 44 | |
45 | 45 | /** @var MemoryInterface $memory */ |
46 | 46 | $memory = $core->getContainer()->get(MemoryInterface::class); |
47 | 47 | |
48 | - file_put_contents(__DIR__ . '/cache/test.php', '<?php broken'); |
|
48 | + file_put_contents(__DIR__.'/cache/test.php', '<?php broken'); |
|
49 | 49 | $this->assertNull($memory->loadData('test')); |
50 | 50 | |
51 | - unlink(__DIR__ . '/cache/test.php'); |
|
51 | + unlink(__DIR__.'/cache/test.php'); |
|
52 | 52 | $this->assertNull($memory->loadData('test')); |
53 | 53 | } |
54 | 54 | } |