Passed
Pull Request — main (#123)
by Andrey
27:30 queued 12:28
created

Optionable   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A hasFull() 0 3 1
A hasForce() 0 3 1
A boolOption() 0 3 2
A hasInline() 0 3 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
24
/** @mixin \Illuminate\Console\Command */
25
trait Optionable
26
{
27
    protected function hasForce(): bool
28
    {
29
        return $this->boolOption('force');
30
    }
31
32
    protected function hasFull(): bool
33
    {
34
        return $this->boolOption('full');
35
    }
36
37
    protected function hasInline(): bool
38
    {
39
        return Config::hasInline();
40
    }
41
42
    protected function boolOption(string $key): bool
43
    {
44
        return $this->hasOption($key) && $this->option($key);
0 ignored issues
show
Bug introduced by
It seems like hasOption() 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

44
        return $this->/** @scrutinizer ignore-call */ hasOption($key) && $this->option($key);
Loading history...
Bug introduced by
It seems like option() 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

44
        return $this->hasOption($key) && $this->/** @scrutinizer ignore-call */ option($key);
Loading history...
45
    }
46
}
47