Passed
Pull Request — main (#123)
by Andrey
42:12 queued 26:54
created

Has::hasJson()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 2
c 2
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the "andrey-helldar/laravel-lang-publisher" project.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * @author Andrey Helldar <[email protected]>
10
 *
11
 * @copyright 2021 Andrey Helldar
12
 *
13
 * @license MIT
14
 *
15
 * @see https://github.com/andrey-helldar/laravel-lang-publisher
16
 */
17
18
declare(strict_types=1);
19
20
namespace Helldar\LaravelLangPublisher\Concerns;
21
22
use Helldar\LaravelLangPublisher\Facades\Helpers\Config;
23
use Helldar\Support\Facades\Helpers\Str;
24
25
/**
26
 * @mixin \Helldar\LaravelLangPublisher\Concerns\Paths
27
 */
28
trait Has
29
{
30
    protected function hasJson(string $filename): bool
31
    {
32
        $extension = $this->extension($filename);
0 ignored issues
show
Bug introduced by
It seems like extension() 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

32
        /** @scrutinizer ignore-call */ 
33
        $extension = $this->extension($filename);
Loading history...
33
34
        return Str::lower($extension) === 'json';
35
    }
36
37
    protected function hasValidation(string $filename): bool
38
    {
39
        $name = $this->filename($filename);
0 ignored issues
show
Bug introduced by
It seems like filename() 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

39
        /** @scrutinizer ignore-call */ 
40
        $name = $this->filename($filename);
Loading history...
40
41
        return Str::startsWith($name, 'validation');
42
    }
43
44
    protected function hasAlignment(): bool
45
    {
46
        return Config::hasAlignment();
47
    }
48
49
    protected function hasInline(): bool
50
    {
51
        return Config::hasInline();
52
    }
53
}
54