Completed
Push — master ( c9a923...7591c0 )
by Karsten
03:22
created

ParameterizedUnaryFunction::getValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
crap 2
1
<?php
2
/**
3
 * File was created 29.05.2015 21:26
4
 *
5
 * @author Karsten J. Gerber <[email protected]>
6
 */
7
8
namespace PeekAndPoke\Component\Psi\Functions;
9
10
use PeekAndPoke\Component\Psi\UnaryFunction;
11
use PeekAndPoke\Types\ValueHolder;
12
13
/**
14
 * @author Karsten J. Gerber <[email protected]>
15
 */
16
class ParameterizedUnaryFunction implements UnaryFunction
17
{
18
    /** @var mixed|ValueHolder */
19
    private $val;
20
    /** @var mixed|ValueHolder */
21
    private $val2;
22
23
    /**
24
     * @param mixed|ValueHolder $val
25
     * @param mixed|ValueHolder $val2
26
     */
27 354
    public function __construct($val, $val2 = null)
28
    {
29 354
        $this->val  = $val;
30 354
        $this->val2 = $val2;
31 354
    }
32
33
    /**
34
     * @return mixed
35
     */
36 342
    public function getValue()
37
    {
38 342
        return $this->val instanceof ValueHolder
39 342
            ? $this->val->getValue()
40 342
            : $this->val;
41
    }
42
43
    /**
44
     * @return mixed
45
     */
46 30
    public function getValue2()
47
    {
48 30
        return $this->val2 instanceof ValueHolder
49 30
            ? $this->val2->getValue()
50 30
            : $this->val2;
51
    }
52
53
    /**
54
     * @param mixed $input
55
     *
56
     * @return null
57
     */
58 6
    public function __invoke($input)
59
    {
60 6
        return null;
61
    }
62
}
63