Test Setup Failed
Push — master ( 8fa0e2...251f8c )
by Gabriel
08:50
created

Command::setReturn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Nip\Dispatcher\Commands;
4
5
use Nip\Dispatcher\Commands\Traits\HasActionTrait;
6
use Nip\Dispatcher\Commands\Traits\HasResponseTrait;
7
use Nip\Dispatcher\Traits\HasRequestTrait;
8
9
/**
10
 * Class ActionCall
11
 * @package Nip\Dispatcher\Resolver\Pipeline
12
 */
13
class Command
14
{
15
    use HasRequestTrait;
16
    use HasActionTrait;
17
18
    protected $return = null;
19
20
    /**
21
     * @return string
22
     */
23 1
    public function getString()
24
    {
25 1
        if ($this->hasAction()) {
26
            return print_r($this->getAction(), true);
27
        }
28
29 1
        if ($this->hasRequest()) {
30
            return print_r($this->getRequest()->getMCA(), true);
31
        }
32
33 1
        return print_r($this, true);
34
    }
35
36
    /**
37
     * @return bool
38
     */
39 4
    public function hasReturn()
40
    {
41 4
        return $this->return !== null;
42
    }
43
44
    /**
45
     * @return null
46
     */
47 3
    public function getReturn()
48
    {
49 3
        return $this->return;
50
    }
51
52
    /**
53
     * @param null $return
54
     */
55 3
    public function setReturn($return)
56
    {
57 3
        $this->return = $return;
58 3
    }
59
}
60