Completed
Push — master ( 984c1e...c9a923 )
by Karsten
03:26
created

ParameterizedUnaryFunction::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
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\Unary;
9
10
use PeekAndPoke\Component\Psi\Interfaces\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 336
    public function __construct($val, $val2 = null)
28
    {
29 336
        $this->val  = $val;
30 336
        $this->val2 = $val2;
31 336
    }
32
33
    /**
34
     * @return mixed
35
     */
36 336
    public function getValue()
37
    {
38 336
        return $this->val instanceof ValueHolder
39 336
            ? $this->val->getValue()
40 336
            : $this->val;
41
    }
42
43
    /**
44
     * @return mixed
45
     */
46 24
    public function getValue2()
47
    {
48 24
        return $this->val2 instanceof ValueHolder
49 24
            ? $this->val2->getValue()
50 24
            : $this->val2;
51
    }
52
53
    /**
54
     * @param mixed $input
55
     *
56
     * @return null
57
     */
58
    public function __invoke($input)
59
    {
60
        return null;
61
    }
62
}
63