Passed
Push — main ( 3f2cb1...ed2a6d )
by Andrey
86:25 queued 84:06
created

Pathable::pathFilename()   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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Concerns;
4
5
use Helldar\LaravelLangPublisher\Facades\Path;
6
7
trait Pathable
8
{
9 24
    protected function pathSource(string $package, string $locale): string
10
    {
11 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

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