DocBlockParser   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 90.91%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
c 2
b 0
f 0
dl 0
loc 21
ccs 10
cts 11
cp 0.9091
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getClassFromMethod() 0 19 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Framework\ClassResolver\DocBlockService;
6
7
final class DocBlockParser
8
{
9 27
    public function getClassFromMethod(string $docBlock, string $method): string
10
    {
11 27
        if ($docBlock === '') {
12 1
            return '';
13
        }
14
15 26
        if (strcasecmp(substr(PHP_OS, 0, 3), 'WIN') === 0) {
16
            $docBlock = str_replace("\n", PHP_EOL, $docBlock);
17
        }
18
19 26
        $lines = array_filter(
20 26
            explode(PHP_EOL, $docBlock),
21 26
            static fn (string $l): bool => str_contains($l, $method),
22 26
        );
23
24 26
        /** @var array<int, string> $lineSplit */
25
        $lineSplit = explode(' ', (string)reset($lines));
26 26
27
        return $lineSplit[3] ?? '';
28
    }
29
}
30