Passed
Push — master ( d8cc68...c5f99b )
by Andrey
21:06 queued 05:59
created

Processable::makeProcessor()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 5
ccs 0
cts 0
cp 0
rs 10
cc 2
nc 1
nop 2
crap 6
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