Passed
Push — main ( 8320d0...c2748c )
by Andrey
45:28 queued 42:35
created

Contains   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 23
ccs 10
cts 10
cp 1
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
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\Facades\Path;
6
use Helldar\Support\Facades\Helpers\Str;
7
8
trait Contains
9
{
10 14
    protected function isValidation(string $filename, bool $is_path = false): bool
11
    {
12 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

12
        $this->/** @scrutinizer ignore-call */ 
13
               log('Does the file contain validation messages?', $filename);
Loading history...
13
14 14
        $filename = $is_path ? Path::filename($filename) : $filename;
15
16 14
        return Str::startsWith($filename, 'validation');
17
    }
18
19 15
    protected function isJson(string $filename): bool
20
    {
21 15
        $this->log('Does the file contain json?', $filename);
22
23 15
        return Str::endsWith($filename, 'json');
24
    }
25
26 14
    protected function isPhp(string $filename): bool
27
    {
28 14
        $this->log('Does the file contain php?', $filename);
29
30 14
        return Str::endsWith($filename, 'php');
31
    }
32
}
33