@@ -58,7 +58,8 @@ |
||
| 58 | 58 | $finalizer->shouldReceive('addFinalizer')->once(); |
| 59 | 59 | |
| 60 | 60 | $container->bind(ConfiguratorInterface::class, new ConfigManager( |
| 61 | - new class() implements LoaderInterface { |
|
| 61 | + new class() implements LoaderInterface |
|
| 62 | + { |
|
| 62 | 63 | public function has(string $section): bool |
| 63 | 64 | { |
| 64 | 65 | return false; |
@@ -40,7 +40,8 @@ |
||
| 40 | 40 | $finalizer->shouldReceive('addFinalizer')->once(); |
| 41 | 41 | |
| 42 | 42 | $this->container->bind(ConfiguratorInterface::class, new ConfigManager( |
| 43 | - new class() implements LoaderInterface { |
|
| 43 | + new class() implements LoaderInterface |
|
| 44 | + { |
|
| 44 | 45 | public function has(string $section): bool |
| 45 | 46 | { |
| 46 | 47 | return false; |
@@ -52,7 +52,8 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $container = new Container(); |
| 54 | 54 | $container->bind(ConfiguratorInterface::class, new ConfigManager( |
| 55 | - new class() implements LoaderInterface { |
|
| 55 | + new class() implements LoaderInterface |
|
| 56 | + { |
|
| 56 | 57 | public function has(string $section): bool |
| 57 | 58 | { |
| 58 | 59 | return false; |
@@ -79,7 +80,8 @@ discard block |
||
| 79 | 80 | { |
| 80 | 81 | $container = new Container(); |
| 81 | 82 | $container->bind(ConfiguratorInterface::class, new ConfigManager( |
| 82 | - new class() implements LoaderInterface { |
|
| 83 | + new class() implements LoaderInterface |
|
| 84 | + { |
|
| 83 | 85 | public function has(string $section): bool |
| 84 | 86 | { |
| 85 | 87 | return false; |
@@ -32,7 +32,8 @@ |
||
| 32 | 32 | $finalizer->shouldReceive('addFinalizer')->once(); |
| 33 | 33 | |
| 34 | 34 | $container->bind(ConfiguratorInterface::class, new ConfigManager( |
| 35 | - new class() implements LoaderInterface { |
|
| 35 | + new class() implements LoaderInterface |
|
| 36 | + { |
|
| 36 | 37 | public function has(string $section): bool |
| 37 | 38 | { |
| 38 | 39 | return false; |
@@ -32,7 +32,8 @@ |
||
| 32 | 32 | $finalizer->shouldReceive('addFinalizer')->once(); |
| 33 | 33 | |
| 34 | 34 | $this->container->bind(ConfiguratorInterface::class, new ConfigManager( |
| 35 | - new class() implements LoaderInterface { |
|
| 35 | + new class() implements LoaderInterface |
|
| 36 | + { |
|
| 36 | 37 | public function has(string $section): bool |
| 37 | 38 | { |
| 38 | 39 | return false; |
@@ -62,8 +62,10 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function getLogger(string $channel = null): LoggerInterface |
| 64 | 64 | { |
| 65 | - if ($channel === null || $channel == self::DEFAULT) { |
|
| 66 | - if ($this->default !== null) { |
|
| 65 | + if ($channel === null || $channel == self::DEFAULT) |
|
| 66 | + { |
|
| 67 | + if ($this->default !== null) |
|
| 68 | + { |
|
| 67 | 69 | // we should use only one default logger per system |
| 68 | 70 | return $this->default; |
| 69 | 71 | } |
@@ -104,15 +106,20 @@ discard block |
||
| 104 | 106 | // always include default handler |
| 105 | 107 | $handlers = []; |
| 106 | 108 | |
| 107 | - foreach ($this->config->getHandlers($channel) as $handler) { |
|
| 108 | - if (! $handler instanceof Autowire) { |
|
| 109 | + foreach ($this->config->getHandlers($channel) as $handler) |
|
| 110 | + { |
|
| 111 | + if (! $handler instanceof Autowire) |
|
| 112 | + { |
|
| 109 | 113 | $handlers[] = $handler; |
| 110 | 114 | continue; |
| 111 | 115 | } |
| 112 | 116 | |
| 113 | - try { |
|
| 117 | + try |
|
| 118 | + { |
|
| 114 | 119 | $handlers[] = $handler->resolve($this->factory); |
| 115 | - } catch (ContainerExceptionInterface $e) { |
|
| 120 | + } |
|
| 121 | + catch (ContainerExceptionInterface $e) |
|
| 122 | + { |
|
| 116 | 123 | throw new ConfigException($e->getMessage(), $e->getCode(), $e); |
| 117 | 124 | } |
| 118 | 125 | } |
@@ -131,20 +138,26 @@ discard block |
||
| 131 | 138 | protected function getProcessors(string $channel): array |
| 132 | 139 | { |
| 133 | 140 | $processors = []; |
| 134 | - foreach ($this->config->getProcessors($channel) as $processor) { |
|
| 135 | - if (! $processor instanceof Autowire) { |
|
| 141 | + foreach ($this->config->getProcessors($channel) as $processor) |
|
| 142 | + { |
|
| 143 | + if (! $processor instanceof Autowire) |
|
| 144 | + { |
|
| 136 | 145 | $processors[] = $processor; |
| 137 | 146 | continue; |
| 138 | 147 | } |
| 139 | 148 | |
| 140 | - try { |
|
| 149 | + try |
|
| 150 | + { |
|
| 141 | 151 | $processors[] = $processor->resolve($this->factory); |
| 142 | - } catch (ContainerExceptionInterface $e) { |
|
| 152 | + } |
|
| 153 | + catch (ContainerExceptionInterface $e) |
|
| 154 | + { |
|
| 143 | 155 | throw new ConfigException($e->getMessage(), $e->getCode(), $e); |
| 144 | 156 | } |
| 145 | 157 | } |
| 146 | 158 | |
| 147 | - if ($processors === []) { |
|
| 159 | + if ($processors === []) |
|
| 160 | + { |
|
| 148 | 161 | $processors[] = new PsrLogMessageProcessor(); |
| 149 | 162 | } |
| 150 | 163 | |
@@ -153,7 +166,8 @@ discard block |
||
| 153 | 166 | |
| 154 | 167 | public function reset() |
| 155 | 168 | { |
| 156 | - if ($this->default instanceof ResettableInterface) { |
|
| 169 | + if ($this->default instanceof ResettableInterface) |
|
| 170 | + { |
|
| 157 | 171 | $this->default->reset(); |
| 158 | 172 | } |
| 159 | 173 | } |
@@ -48,18 +48,22 @@ discard block |
||
| 48 | 48 | public function boot(Container $container, FinalizerInterface $finalizer): void |
| 49 | 49 | { |
| 50 | 50 | $finalizer->addFinalizer(static function () use ($container): void { |
| 51 | - if ($container->hasInstance(LoggerInterface::class)) { |
|
| 51 | + if ($container->hasInstance(LoggerInterface::class)) |
|
| 52 | + { |
|
| 52 | 53 | $logger = $container->get(LoggerInterface::class); |
| 53 | 54 | |
| 54 | - if ($logger instanceof ResettableInterface) { |
|
| 55 | + if ($logger instanceof ResettableInterface) |
|
| 56 | + { |
|
| 55 | 57 | $logger->reset(); |
| 56 | 58 | } |
| 57 | 59 | } |
| 58 | 60 | |
| 59 | - if ($container->hasInstance(LogsInterface::class)) { |
|
| 61 | + if ($container->hasInstance(LogsInterface::class)) |
|
| 62 | + { |
|
| 60 | 63 | $factory = $container->get(LogsInterface::class); |
| 61 | 64 | |
| 62 | - if ($factory instanceof ResettableInterface) { |
|
| 65 | + if ($factory instanceof ResettableInterface) |
|
| 66 | + { |
|
| 63 | 67 | $factory->reset(); |
| 64 | 68 | } |
| 65 | 69 | } |
@@ -77,7 +81,8 @@ discard block |
||
| 77 | 81 | { |
| 78 | 82 | $name = MonologConfig::CONFIG; |
| 79 | 83 | |
| 80 | - if (! isset($this->config->getConfig($name)['handlers'][$channel])) { |
|
| 84 | + if (! isset($this->config->getConfig($name)['handlers'][$channel])) |
|
| 85 | + { |
|
| 81 | 86 | $this->config->modify($name, new Append('handlers', $channel, [])); |
| 82 | 87 | } |
| 83 | 88 | |