Passed
Pull Request — main (#104)
by Andrey
84:07 queued 69:01
created

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