AbstractLoggableExtractor   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 22
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getLoggableResources() 0 12 3
A __construct() 0 2 1
1
<?php
2
3
namespace Locastic\Loggastic\Metadata\Extractor;
4
5
abstract class AbstractLoggableExtractor implements LoggableExtractorInterface
6
{
7
    protected ?array $loggableClasses = null;
8
9
    public function __construct(private readonly array $loggablePaths)
10
    {
11
    }
12
13
    abstract protected function extractPath(string $path);
14
15
    public function getLoggableResources(): array
16
    {
17
        if (null !== $this->loggableClasses) {
18
            return $this->loggableClasses;
19
        }
20
21
        $this->loggableClasses = [];
22
        foreach ($this->loggablePaths as $path) {
23
            $this->extractPath($path);
24
        }
25
26
        return $this->loggableClasses;
27
    }
28
}
29