AbstractStage::hasClassAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Nip\Dispatcher\Resolver\Pipeline\Stages;
4
5
use Nip\Dispatcher\Commands\Command;
6
7
/**
8
 * Class AbstractStage
9
 * @package Nip\Dispatcher\Resolver\Pipeline\Stages
10
 */
11
abstract class AbstractStage implements StageInterface
12
{
13
    /**
14
     * @var Command
15
     */
16
    protected $command;
17
18
    /**
19
     * @param Command $methodCall
20
     * @return Command
21
     */
22 5
    public function __invoke(Command $command): Command
23
    {
24 5
        $this->setCommand($command);
25 5
        $this->processCommand();
26 5
        return $command;
27
    }
28
29
    /**
30
     * @return void
31
     */
32
    abstract public function processCommand();
33
34
    /**
35
     * @return Command
36
     */
37 5
    public function getCommand(): Command
38
    {
39 5
        return $this->command;
40
    }
41
42
    /**
43
     * @param Command $command
44
     */
45 5
    public function setCommand(Command $command)
46
    {
47 5
        $this->command = $command;
48 5
    }
49
50
    /**
51
     * @return bool
52
     */
53 3
    protected function hasClassAction()
54
    {
55 3
        return $this->getCommand()->hasActionParam('class');
56
    }
57
58
    /**
59
     * @return bool
60
     */
61 4
    protected function hasInstanceAction()
62
    {
63 4
        return $this->getCommand()->hasActionParam('instance');
64
    }
65
}
66