Passed
Push — main ( c2748c...e886f6 )
by Andrey
90:35 queued 86:23
created

Contains::isEnglish()   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
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Concerns;
4
5
use Helldar\LaravelLangPublisher\Constants\Locales as LocalesList;
6
use Helldar\LaravelLangPublisher\Facades\Path;
7
use Helldar\Support\Facades\Helpers\Str;
8
9
trait Contains
10
{
11 14
    protected function isValidation(string $filename, bool $is_path = false): bool
12
    {
13 14
        $this->log('Does the file contain validation messages?', $filename);
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

13
        $this->/** @scrutinizer ignore-call */ 
14
               log('Does the file contain validation messages?', $filename);
Loading history...
14
15 14
        $filename = $is_path ? Path::filename($filename) : $filename;
16
17 14
        return Str::startsWith($filename, 'validation');
18
    }
19
20 15
    protected function isJson(string $filename): bool
21
    {
22 15
        $this->log('Does the file contain json?', $filename);
23
24 15
        return Str::endsWith($filename, 'json');
25
    }
26
27 14
    protected function isPhp(string $filename): bool
28
    {
29 14
        $this->log('Does the file contain php?', $filename);
30
31 14
        return Str::endsWith($filename, 'php');
32
    }
33
34 24
    protected function isEnglish(string $locale): bool
35
    {
36 24
        $this->log('Check if localization is English: ' . $locale);
37
38 24
        return $locale === LocalesList::ENGLISH;
39
    }
40
}
41