Processable::getProcessor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 1
cts 1
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Traits\Containers;
4
5
use Helldar\LaravelLangPublisher\Contracts\Pathable as PathContract;
6
use Helldar\LaravelLangPublisher\Contracts\Processor;
7
use Illuminate\Container\Container;
8
9
trait Processable
10
{
11
    /** @var string */
12
    protected $processor;
13 78
14
    protected function getProcessor(): Processor
15 78
    {
16
        return $this->makeProcessor($this->processor, $this->getPath());
0 ignored issues
show
Bug introduced by
It seems like getPath() 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
        return $this->makeProcessor($this->processor, $this->/** @scrutinizer ignore-call */ getPath());
Loading history...
17 78
    }
18
19
    protected function makeProcessor(string $processor, PathContract $path = null): Processor
20
    {
21
        $path = $path ?: $this->getPath();
22
23
        return Container::getInstance()->make($processor, compact('path'));
24
    }
25
}
26