HasSuffixOption::getSuffix()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 10
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace LaraGeoData\Console\Commands;
4
5
use Illuminate\Support\Str;
6
7
trait HasSuffixOption
8
{
9
    /**
10
     * Get formatted suffix.
11
     *
12
     * @return string|null
13
     */
14 13
    protected function getSuffix(): ?string
15
    {
16 13
        $suffix = $this->option('suffix');
0 ignored issues
show
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

16
        /** @scrutinizer ignore-call */ 
17
        $suffix = $this->option('suffix');
Loading history...
17 13
        if ($suffix) {
18 9
            $suffix = Str::snake($suffix);
19
        }
20
21 13
        return $suffix;
22
    }
23
}
24