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

Contains   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 30
ccs 13
cts 13
cp 1
rs 10
c 1
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A isEnglish() 0 5 1
A isJson() 0 5 1
A isValidation() 0 7 2
A isPhp() 0 5 1
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