Passed
Push — feature/custom-services-v2 ( f3d61c...0bc47e )
by Chema
03:49
created

DocBlockParser   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 16
ccs 8
cts 8
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getClassFromMethod() 0 14 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Framework\ClassResolver\CustomService;
6
7
final class DocBlockParser
8
{
9 3
    public function getClassFromMethod(string $docBlock, string $method): string
10
    {
11 3
        if ($docBlock === '') {
12 1
            return '';
13
        }
14
15 2
        $lines = array_filter(
16 2
            explode(PHP_EOL, $docBlock),
17 2
            static fn (string $l) => str_contains($l, $method)
18
        );
19
20 2
        $lineSplit = (array)explode(' ', (string)reset($lines));
21
22 2
        return $lineSplit[3] ?? '';
23
    }
24
}
25