Total Complexity | 4 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | class LoggerService |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * @var ContainerInterface |
||
15 | */ |
||
16 | protected $container; |
||
17 | /** |
||
18 | * @var ApplicationConfig |
||
19 | */ |
||
20 | protected $config; |
||
21 | protected $scope = []; |
||
22 | |||
23 | /** |
||
24 | * @param ApplicationConfig $config |
||
25 | * @param ContainerInterface $container |
||
26 | */ |
||
27 | public function __construct(ApplicationConfig $config, ContainerInterface $container) |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param string $name |
||
35 | * |
||
36 | * @return LoggerInterface |
||
37 | */ |
||
38 | public function get(string $name): LoggerInterface |
||
39 | { |
||
40 | if (!isset($this->scope[$name])) { |
||
41 | $this->scope[$name] = $this->create($name); |
||
42 | } |
||
43 | |||
44 | return $this->scope[$name]; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param string $name |
||
49 | * |
||
50 | * @return LoggerInterface |
||
51 | */ |
||
52 | protected function create(string $name): LoggerInterface |
||
57 | } |
||
58 | } |
||
59 |