| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | 1 | public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
|
| 29 | { |
||
| 30 | 1 | if (!$this->logger) { |
|
| 31 | // Log to file |
||
| 32 | 1 | $this->logger = new Logger(); |
|
| 33 | 1 | $fileWriter = new Stream('logs/all.log'); |
|
| 34 | 1 | $this->logger->addWriter($fileWriter); |
|
| 35 | |||
| 36 | 1 | $logRepository = $container->get(EntityManager::class)->getRepository(Log::class); |
|
| 37 | 1 | $config = $container->get('config'); |
|
| 38 | 1 | $baseUrl = 'https://' . $config['hostname']; |
|
| 39 | |||
| 40 | 1 | $dbWriter = new DbWriter($logRepository, $baseUrl); |
|
| 41 | 1 | $dbWriter->addFilter(Logger::INFO); |
|
| 42 | 1 | $this->logger->addWriter($dbWriter); |
|
| 43 | } |
||
| 44 | |||
| 45 | 1 | return $this->logger; |
|
| 46 | } |
||
| 48 |