@@ -35,13 +35,13 @@ |
||
35 | 35 | |
36 | 36 | public function testCache(): void |
37 | 37 | { |
38 | - $this->assertCount(0, $this->files->getFiles(__DIR__ . '/cache/', '*.php')); |
|
38 | + $this->assertCount(0, $this->files->getFiles(__DIR__.'/cache/', '*.php')); |
|
39 | 39 | |
40 | 40 | $s = $this->getStempler(); |
41 | 41 | $this->assertSame('test', $s->get('test', new ViewContext())->render([])); |
42 | - $this->assertCount(2, $this->files->getFiles(__DIR__ . '/cache/', '*.php')); |
|
42 | + $this->assertCount(2, $this->files->getFiles(__DIR__.'/cache/', '*.php')); |
|
43 | 43 | |
44 | 44 | $s->reset('test', new ViewContext()); |
45 | - $this->assertCount(0, $this->files->getFiles(__DIR__ . '/../cache/', '*.php')); |
|
45 | + $this->assertCount(0, $this->files->getFiles(__DIR__.'/../cache/', '*.php')); |
|
46 | 46 | } |
47 | 47 | } |
@@ -3,12 +3,12 @@ |
||
3 | 3 | return [ |
4 | 4 | 'cache' => [ |
5 | 5 | 'enabled' => false, |
6 | - 'directory' => __DIR__ . '/../cache' |
|
6 | + 'directory' => __DIR__.'/../cache' |
|
7 | 7 | ], |
8 | 8 | 'namespaces' => [ |
9 | - 'default' => [__DIR__ . '/../fixtures/default'], |
|
10 | - 'other' => [__DIR__ . '/../fixtures/other'], |
|
11 | - 'extensions' => [__DIR__ . '/../fixtures/other/extensions'], |
|
9 | + 'default' => [__DIR__.'/../fixtures/default'], |
|
10 | + 'other' => [__DIR__.'/../fixtures/other'], |
|
11 | + 'extensions' => [__DIR__.'/../fixtures/other/extensions'], |
|
12 | 12 | ], |
13 | 13 | 'dependencies' => [], |
14 | 14 | 'engines' => [] |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | public function testBootloaderDirective(): void |
85 | 85 | { |
86 | - $this->container->bind('testBinding', function () { |
|
86 | + $this->container->bind('testBinding', function (){ |
|
87 | 87 | return 'test result'; |
88 | 88 | }); |
89 | 89 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | public function testBootloaderProcessors(): void |
103 | 103 | { |
104 | - $this->container->bind('testBinding', function () { |
|
104 | + $this->container->bind('testBinding', function (){ |
|
105 | 105 | return 'test result'; |
106 | 106 | }); |
107 | 107 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | public function testBootloaderVisitors(): void |
121 | 121 | { |
122 | - $this->container->bind('testBinding', function () { |
|
122 | + $this->container->bind('testBinding', function (){ |
|
123 | 123 | return 'test result'; |
124 | 124 | }); |
125 | 125 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | public function testBootloaderVisitors0(): void |
139 | 139 | { |
140 | - $this->container->bind('testBinding', function () { |
|
140 | + $this->container->bind('testBinding', function (){ |
|
141 | 141 | return 'test result'; |
142 | 142 | }); |
143 | 143 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | public function testBootloaderVisitors2(): void |
157 | 157 | { |
158 | - $this->container->bind('testBinding', function () { |
|
158 | + $this->container->bind('testBinding', function (){ |
|
159 | 159 | return 'test result'; |
160 | 160 | }); |
161 | 161 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | public function testBootloaderVisitors3(): void |
175 | 175 | { |
176 | - $this->container->bind('testBinding', function () { |
|
176 | + $this->container->bind('testBinding', function (){ |
|
177 | 177 | return 'test result'; |
178 | 178 | }); |
179 | 179 |
@@ -83,7 +83,8 @@ discard block |
||
83 | 83 | |
84 | 84 | public function testBootloaderDirective(): void |
85 | 85 | { |
86 | - $this->container->bind('testBinding', function () { |
|
86 | + $this->container->bind('testBinding', function () |
|
87 | + { |
|
87 | 88 | return 'test result'; |
88 | 89 | }); |
89 | 90 | |
@@ -101,7 +102,8 @@ discard block |
||
101 | 102 | |
102 | 103 | public function testBootloaderProcessors(): void |
103 | 104 | { |
104 | - $this->container->bind('testBinding', function () { |
|
105 | + $this->container->bind('testBinding', function () |
|
106 | + { |
|
105 | 107 | return 'test result'; |
106 | 108 | }); |
107 | 109 | |
@@ -119,7 +121,8 @@ discard block |
||
119 | 121 | |
120 | 122 | public function testBootloaderVisitors(): void |
121 | 123 | { |
122 | - $this->container->bind('testBinding', function () { |
|
124 | + $this->container->bind('testBinding', function () |
|
125 | + { |
|
123 | 126 | return 'test result'; |
124 | 127 | }); |
125 | 128 | |
@@ -137,7 +140,8 @@ discard block |
||
137 | 140 | |
138 | 141 | public function testBootloaderVisitors0(): void |
139 | 142 | { |
140 | - $this->container->bind('testBinding', function () { |
|
143 | + $this->container->bind('testBinding', function () |
|
144 | + { |
|
141 | 145 | return 'test result'; |
142 | 146 | }); |
143 | 147 | |
@@ -155,7 +159,8 @@ discard block |
||
155 | 159 | |
156 | 160 | public function testBootloaderVisitors2(): void |
157 | 161 | { |
158 | - $this->container->bind('testBinding', function () { |
|
162 | + $this->container->bind('testBinding', function () |
|
163 | + { |
|
159 | 164 | return 'test result'; |
160 | 165 | }); |
161 | 166 | |
@@ -173,7 +178,8 @@ discard block |
||
173 | 178 | |
174 | 179 | public function testBootloaderVisitors3(): void |
175 | 180 | { |
176 | - $this->container->bind('testBinding', function () { |
|
181 | + $this->container->bind('testBinding', function () |
|
182 | + { |
|
177 | 183 | return 'test result'; |
178 | 184 | }); |
179 | 185 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | MonologConfig $config, |
51 | 51 | ListenerRegistryInterface $listenerRegistry, |
52 | 52 | FactoryInterface $factory |
53 | - ) { |
|
53 | + ){ |
|
54 | 54 | $this->config = $config; |
55 | 55 | $this->factory = $factory; |
56 | 56 | $this->eventHandler = new EventHandler($listenerRegistry, $config->getEventLevel()); |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function getLogger(string $channel = null): LoggerInterface |
63 | 63 | { |
64 | - if ($channel === null || $channel == self::DEFAULT) { |
|
65 | - if ($this->default !== null) { |
|
64 | + if ($channel === null || $channel == self::DEFAULT){ |
|
65 | + if ($this->default !== null){ |
|
66 | 66 | // we should use only one default logger per system |
67 | 67 | return $this->default; |
68 | 68 | } |
@@ -103,15 +103,15 @@ discard block |
||
103 | 103 | // always include default handler |
104 | 104 | $handlers = []; |
105 | 105 | |
106 | - foreach ($this->config->getHandlers($channel) as $handler) { |
|
107 | - if (!$handler instanceof Autowire) { |
|
106 | + foreach ($this->config->getHandlers($channel) as $handler){ |
|
107 | + if (!$handler instanceof Autowire){ |
|
108 | 108 | $handlers[] = $handler; |
109 | 109 | continue; |
110 | 110 | } |
111 | 111 | |
112 | - try { |
|
112 | + try{ |
|
113 | 113 | $handlers[] = $handler->resolve($this->factory); |
114 | - } catch (ContainerExceptionInterface $e) { |
|
114 | + }catch (ContainerExceptionInterface $e){ |
|
115 | 115 | throw new ConfigException($e->getMessage(), $e->getCode(), $e); |
116 | 116 | } |
117 | 117 | } |
@@ -61,8 +61,10 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function getLogger(string $channel = null): LoggerInterface |
63 | 63 | { |
64 | - if ($channel === null || $channel == self::DEFAULT) { |
|
65 | - if ($this->default !== null) { |
|
64 | + if ($channel === null || $channel == self::DEFAULT) |
|
65 | + { |
|
66 | + if ($this->default !== null) |
|
67 | + { |
|
66 | 68 | // we should use only one default logger per system |
67 | 69 | return $this->default; |
68 | 70 | } |
@@ -103,15 +105,20 @@ discard block |
||
103 | 105 | // always include default handler |
104 | 106 | $handlers = []; |
105 | 107 | |
106 | - foreach ($this->config->getHandlers($channel) as $handler) { |
|
107 | - if (!$handler instanceof Autowire) { |
|
108 | + foreach ($this->config->getHandlers($channel) as $handler) |
|
109 | + { |
|
110 | + if (!$handler instanceof Autowire) |
|
111 | + { |
|
108 | 112 | $handlers[] = $handler; |
109 | 113 | continue; |
110 | 114 | } |
111 | 115 | |
112 | - try { |
|
116 | + try |
|
117 | + { |
|
113 | 118 | $handlers[] = $handler->resolve($this->factory); |
114 | - } catch (ContainerExceptionInterface $e) { |
|
119 | + } |
|
120 | + catch (ContainerExceptionInterface $e) |
|
121 | + { |
|
115 | 122 | throw new ConfigException($e->getMessage(), $e->getCode(), $e); |
116 | 123 | } |
117 | 124 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | final class LogFactory implements LogsInterface, InjectorInterface |
28 | 28 | { |
29 | 29 | // Default logger channel (supplied via injection) |
30 | - public const DEFAULT = 'default'; |
|
30 | + public const default = 'default'; |
|
31 | 31 | |
32 | 32 | /** @var MonologConfig */ |
33 | 33 | private $config; |
@@ -61,16 +61,16 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function getLogger(string $channel = null): LoggerInterface |
63 | 63 | { |
64 | - if ($channel === null || $channel == self::DEFAULT) { |
|
64 | + if ($channel === null || $channel == self::default) { |
|
65 | 65 | if ($this->default !== null) { |
66 | 66 | // we should use only one default logger per system |
67 | 67 | return $this->default; |
68 | 68 | } |
69 | 69 | |
70 | 70 | return $this->default = new Logger( |
71 | - self::DEFAULT, |
|
72 | - $this->getHandlers(self::DEFAULT), |
|
73 | - $this->getProcessors(self::DEFAULT) |
|
71 | + self::default, |
|
72 | + $this->getHandlers(self::default), |
|
73 | + $this->getProcessors(self::default) |
|
74 | 74 | ); |
75 | 75 | } |
76 | 76 |
@@ -64,12 +64,12 @@ |
||
64 | 64 | */ |
65 | 65 | public function addHandler(string $channel, HandlerInterface $handler): void |
66 | 66 | { |
67 | - if (!isset($this->config->getConfig('monolog')['handlers'][$channel])) { |
|
67 | + if (!isset($this->config->getConfig('monolog')['handlers'][$channel])){ |
|
68 | 68 | $this->config->modify('monolog', new Append('handlers', $channel, [])); |
69 | 69 | } |
70 | 70 | |
71 | 71 | $this->config->modify('monolog', new Append( |
72 | - 'handlers.' . $channel, |
|
72 | + 'handlers.'.$channel, |
|
73 | 73 | null, |
74 | 74 | $handler |
75 | 75 | )); |
@@ -64,7 +64,8 @@ |
||
64 | 64 | */ |
65 | 65 | public function addHandler(string $channel, HandlerInterface $handler): void |
66 | 66 | { |
67 | - if (!isset($this->config->getConfig('monolog')['handlers'][$channel])) { |
|
67 | + if (!isset($this->config->getConfig('monolog')['handlers'][$channel])) |
|
68 | + { |
|
68 | 69 | $this->config->modify('monolog', new Append('handlers', $channel, [])); |
69 | 70 | } |
70 | 71 |
@@ -42,18 +42,18 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function getHandlers(string $channel): \Generator |
44 | 44 | { |
45 | - if (empty($this->config['handlers'][$channel])) { |
|
45 | + if (empty($this->config['handlers'][$channel])){ |
|
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | - foreach ($this->config['handlers'][$channel] as $handler) { |
|
50 | - if (is_object($handler) && !$handler instanceof Autowire) { |
|
49 | + foreach ($this->config['handlers'][$channel] as $handler){ |
|
50 | + if (is_object($handler) && !$handler instanceof Autowire){ |
|
51 | 51 | yield $handler; |
52 | 52 | continue; |
53 | 53 | } |
54 | 54 | |
55 | 55 | $wire = $this->wire($channel, $handler); |
56 | - if (!empty($wire)) { |
|
56 | + if (!empty($wire)){ |
|
57 | 57 | yield $wire; |
58 | 58 | } |
59 | 59 | } |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | */ |
69 | 69 | private function wire(string $channel, $handler): ?Autowire |
70 | 70 | { |
71 | - if ($handler instanceof Autowire) { |
|
71 | + if ($handler instanceof Autowire){ |
|
72 | 72 | return $handler; |
73 | 73 | } |
74 | 74 | |
75 | - if (is_string($handler)) { |
|
75 | + if (is_string($handler)){ |
|
76 | 76 | return new Autowire($handler); |
77 | 77 | } |
78 | 78 | |
79 | - if (isset($handler['class'])) { |
|
79 | + if (isset($handler['class'])){ |
|
80 | 80 | return new Autowire($handler['class'], $handler['options'] ?? []); |
81 | 81 | } |
82 | 82 |
@@ -42,18 +42,22 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function getHandlers(string $channel): \Generator |
44 | 44 | { |
45 | - if (empty($this->config['handlers'][$channel])) { |
|
45 | + if (empty($this->config['handlers'][$channel])) |
|
46 | + { |
|
46 | 47 | return; |
47 | 48 | } |
48 | 49 | |
49 | - foreach ($this->config['handlers'][$channel] as $handler) { |
|
50 | - if (is_object($handler) && !$handler instanceof Autowire) { |
|
50 | + foreach ($this->config['handlers'][$channel] as $handler) |
|
51 | + { |
|
52 | + if (is_object($handler) && !$handler instanceof Autowire) |
|
53 | + { |
|
51 | 54 | yield $handler; |
52 | 55 | continue; |
53 | 56 | } |
54 | 57 | |
55 | 58 | $wire = $this->wire($channel, $handler); |
56 | - if (!empty($wire)) { |
|
59 | + if (!empty($wire)) |
|
60 | + { |
|
57 | 61 | yield $wire; |
58 | 62 | } |
59 | 63 | } |
@@ -68,15 +72,18 @@ discard block |
||
68 | 72 | */ |
69 | 73 | private function wire(string $channel, $handler): ?Autowire |
70 | 74 | { |
71 | - if ($handler instanceof Autowire) { |
|
75 | + if ($handler instanceof Autowire) |
|
76 | + { |
|
72 | 77 | return $handler; |
73 | 78 | } |
74 | 79 | |
75 | - if (is_string($handler)) { |
|
80 | + if (is_string($handler)) |
|
81 | + { |
|
76 | 82 | return new Autowire($handler); |
77 | 83 | } |
78 | 84 | |
79 | - if (isset($handler['class'])) { |
|
85 | + if (isset($handler['class'])) |
|
86 | + { |
|
80 | 87 | return new Autowire($handler['class'], $handler['options'] ?? []); |
81 | 88 | } |
82 | 89 |
@@ -53,7 +53,7 @@ |
||
53 | 53 | { |
54 | 54 | $container = new Container(); |
55 | 55 | $container->bind(ConfiguratorInterface::class, new ConfigManager( |
56 | - new class() implements LoaderInterface { |
|
56 | + new class() implements LoaderInterface{ |
|
57 | 57 | public function has(string $section): bool |
58 | 58 | { |
59 | 59 | return false; |
@@ -53,7 +53,8 @@ |
||
53 | 53 | { |
54 | 54 | $container = new Container(); |
55 | 55 | $container->bind(ConfiguratorInterface::class, new ConfigManager( |
56 | - new class() implements LoaderInterface { |
|
56 | + new class() implements LoaderInterface |
|
57 | + { |
|
57 | 58 | public function has(string $section): bool |
58 | 59 | { |
59 | 60 | return false; |
@@ -43,7 +43,7 @@ |
||
43 | 43 | |
44 | 44 | $container = new Container(); |
45 | 45 | $container->bind(ConfiguratorInterface::class, new ConfigManager( |
46 | - new class() implements LoaderInterface { |
|
46 | + new class() implements LoaderInterface{ |
|
47 | 47 | public function has(string $section): bool |
48 | 48 | { |
49 | 49 | return false; |
@@ -43,7 +43,8 @@ |
||
43 | 43 | |
44 | 44 | $container = new Container(); |
45 | 45 | $container->bind(ConfiguratorInterface::class, new ConfigManager( |
46 | - new class() implements LoaderInterface { |
|
46 | + new class() implements LoaderInterface |
|
47 | + { |
|
47 | 48 | public function has(string $section): bool |
48 | 49 | { |
49 | 50 | return false; |
@@ -33,7 +33,7 @@ |
||
33 | 33 | |
34 | 34 | $this->assertNotEmpty($logger); |
35 | 35 | $this->assertSame($logger, $factory->getLogger()); |
36 | - $this->assertSame($logger, $factory->getLogger(LogFactory::DEFAULT)); |
|
36 | + $this->assertSame($logger, $factory->getLogger(LogFactory::default)); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function testInjection(): void |
@@ -35,7 +35,7 @@ |
||
35 | 35 | { |
36 | 36 | $this->container = new Container(); |
37 | 37 | $this->container->bind(ConfiguratorInterface::class, new ConfigManager( |
38 | - new class() implements LoaderInterface { |
|
38 | + new class() implements LoaderInterface{ |
|
39 | 39 | public function has(string $section): bool |
40 | 40 | { |
41 | 41 | return false; |
@@ -35,7 +35,8 @@ |
||
35 | 35 | { |
36 | 36 | $this->container = new Container(); |
37 | 37 | $this->container->bind(ConfiguratorInterface::class, new ConfigManager( |
38 | - new class() implements LoaderInterface { |
|
38 | + new class() implements LoaderInterface |
|
39 | + { |
|
39 | 40 | public function has(string $section): bool |
40 | 41 | { |
41 | 42 | return false; |