Passed
Push — 10.x ( d6d64f...175d11 )
by Andrey
13:22
created

Path::vendor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
ccs 3
cts 3
cp 1
crap 1
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Support;
4
5
use Helldar\LaravelLangPublisher\Facades\Config as ConfigSupport;
6
7
final class Path
8
{
9
    public function basename(string $filename): string
10
    {
11
        return pathinfo($filename, PATHINFO_BASENAME);
0 ignored issues
show
Bug Best Practice introduced by
The expression return pathinfo($filenam...port\PATHINFO_BASENAME) could return the type array which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
12
    }
13 24
14
    public function filename(string $filename): string
15 24
    {
16
        return pathinfo($filename, PATHINFO_FILENAME);
0 ignored issues
show
Bug Best Practice introduced by
The expression return pathinfo($filenam...port\PATHINFO_FILENAME) could return the type array which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
17 24
    }
18 24
19
    public function extension(string $filename): string
20
    {
21 7
        return pathinfo($filename, PATHINFO_EXTENSION);
0 ignored issues
show
Bug Best Practice introduced by
The expression return pathinfo($filenam...ort\PATHINFO_EXTENSION) could return the type array which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
22
    }
23
24 24
    public function vendor(string $path): string
25
    {
26 24
        $vendor = ConfigSupport::vendor();
27
28 24
        return $this->clean($vendor, $path);
29
    }
30 24
31
    protected function clean(...$values): string
32 24
    {
33
        foreach ($values as &$value) {
34
            $value = trim($value, " \t\n\r\0\x0B\\/");
35 15
        }
36
37 15
        return implode('/', $values);
38
    }
39
}
40