Completed
Push — master ( 98a387...930a12 )
by Karsten
02:16
created

AbstractParameterizedUnaryFunction::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
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
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\Unary;
9
10
use PeekAndPoke\Types\ValueHolder;
11
12
/**
13
 * AbstractParameterisedUnaryFunction
14
 *
15
 * @author Karsten J. Gerber <[email protected]>
16
 */
17
abstract class AbstractParameterizedUnaryFunction extends AbstractUnaryFunction
18
{
19
    /** @var mixed|ValueHolder */
20
    private $val;
21
    /** @var mixed|ValueHolder */
22
    private $val2;
23
24
    /**
25
     * @param mixed|ValueHolder $val
26
     * @param mixed|ValueHolder $val2
27
     */
28 161
    public function __construct($val, $val2 = null)
29
    {
30 161
        parent::__construct();
31
32 161
        $this->val  = $val;
33 161
        $this->val2 = $val2;
34 161
    }
35
36
    /**
37
     * @return mixed
38
     */
39 161
    public function getValue()
40
    {
41 161
        return $this->val instanceof ValueHolder
42 161
            ? $this->val->getValue()
43 161
            : $this->val;
44
    }
45
46
    /**
47
     * @return mixed
48
     */
49 12
    public function getValue2()
50
    {
51 12
        return $this->val2 instanceof ValueHolder
52 12
            ? $this->val2->getValue()
53 12
            : $this->val2;
54
    }
55
}
56