FqcnRemover   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
dl 0
loc 16
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A removeRqcn() 0 11 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DaveLiddament\StaticAnalysisResultsBaseliner\Domain\Utils;
6
7
/**
8
 * Use case for this is when static analysis tools don't provide a classification for the type of bug found.
9
 * See docs/ViolationTypeClassificationGuessing.md.
10
 */
11
final class FqcnRemover
12
{
13
    /**
14
     * Removes anything that looks like a FQCN from the string.
15
     */
16
    public function removeRqcn(string $raw): string
17
    {
18
        $parts = explode(' ', $raw);
19
        $outputParts = [];
20
        foreach ($parts as $part) {
21
            if (!str_contains($part, '\\')) {
22
                $outputParts[] = $part;
23
            }
24
        }
25
26
        return implode(' ', $outputParts);
27
    }
28
}
29