AbstractLoggableExtractor::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 2
rs 10
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