Passed
Push — main ( 8320d0...c2748c )
by Andrey
45:28 queued 42:35
created

Pathable::pathVendor()   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 0
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Concerns;
4
5
use Helldar\LaravelLangPublisher\Facades\Config;
6
use Helldar\LaravelLangPublisher\Facades\Path;
7
8
trait Pathable
9
{
10 24
    protected function pathSource(string $package, string $locale): string
11
    {
12 24
        $this->log('Retrieving a link to the source directory for the', $package, 'package and the', $locale, 'localization...');
0 ignored issues
show
Bug introduced by
It seems like log() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

12
        $this->/** @scrutinizer ignore-call */ 
13
               log('Retrieving a link to the source directory for the', $package, 'package and the', $locale, 'localization...');
Loading history...
13
14 24
        return Path::source($package, $locale);
15
    }
16
17 24
    protected function pathTarget(string $locale, bool $is_json = false): string
18
    {
19 24
        $this->log('Retrieving a link to the target directory for the', $locale, '(is json:', $is_json, ') localization...');
20
21 24
        return Path::target($locale, $is_json);
22
    }
23
24 15
    protected function pathTargetFull(string $locale, ?string $filename): string
25
    {
26 15
        $this->log('Retrieving a link to the target file for the', $locale, 'localization, filename is ', $filename, '...');
27
28 15
        return Path::targetFull($locale, $filename);
29
    }
30
31 19
    protected function pathLocales(string $package, string $locale = null): string
32
    {
33 19
        $this->log('Getting the path to excluding English localization: ' . $locale);
34
35 19
        return Path::locales($package, $locale);
36
    }
37
38 24
    protected function pathVendor(): string
39
    {
40 24
        $this->log('Getting the vendor path.');
41
42 24
        return Config::basePath();
43
    }
44
45 14
    protected function pathDirectory(string $path): ?string
46
    {
47 14
        $this->log('Getting file directory:', $path);
48
49 14
        $directory = Path::directory($path);
50
51 14
        return $directory !== '.' ? $directory : null;
52
    }
53
54 14
    protected function pathFilename(string $path): string
55
    {
56 14
        $this->log('Getting file name without extension:', $path);
57
58 14
        return Path::filename($path);
59
    }
60
61 14
    protected function pathExtension(string $path): string
62
    {
63 14
        $this->log('Getting file extension:', $path);
64
65 14
        return Path::extension($path);
66
    }
67
}
68