Passed
Pull Request — main (#109)
by Andrey
71:41 queued 56:39
created

Contains::isEnglish()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 0
cp 0
crap 2
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 14
{
11
    protected function isValidation(string $filename, bool $is_path = false): bool
12 14
    {
13
        $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 14
15
        $filename = $is_path ? Path::filename($filename) : $filename;
16 14
17
        return Str::startsWith($filename, 'validation');
18
    }
19 15
20
    protected function isJson(string $filename): bool
21 15
    {
22
        $this->log('Does the file contain json?', $filename);
23 15
24
        return Str::endsWith($filename, 'json');
25
    }
26 14
27
    protected function isPhp(string $filename): bool
28 14
    {
29
        $this->log('Does the file contain php?', $filename);
30 14
31
        return Str::endsWith($filename, 'php');
32
    }
33
34
    protected function isEnglish(string $locale): bool
35
    {
36
        $this->log('Check if localization is English: ' . $locale);
37
38
        return $locale === LocalesList::ENGLISH;
39
    }
40
}
41