Total Complexity | 8 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Coverage | 94.12% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class LoggerPool |
||
8 | { |
||
9 | /** |
||
10 | * @var array<int,\sweetrdf\InMemoryStoreSqlite\Log\Logger> |
||
11 | */ |
||
12 | private array $logger = []; |
||
13 | |||
14 | 106 | public function createNewLogger(string $id): Logger |
|
15 | { |
||
16 | 106 | $this->logger[$id] = new Logger(); |
|
17 | |||
18 | 106 | return $this->logger[$id]; |
|
19 | } |
||
20 | |||
21 | 2 | public function getLogger(string $id): Logger |
|
22 | { |
||
23 | 2 | if (isset($this->logger[$id])) { |
|
24 | 1 | return $this->logger[$id]; |
|
25 | } |
||
26 | |||
27 | 1 | throw new Exception('Invalid ID given.'); |
|
28 | } |
||
29 | |||
30 | 3 | public function getEntriesFromAllLoggerInstances(?string $level = null): iterable |
|
39 | } |
||
40 | |||
41 | 2 | public function hasEntriesInAnyLoggerInstance(?string $level = null): bool |
|
50 | } |
||
51 | } |
||
52 |