Completed
Push — master ( 36249c...ba9366 )
by Karsten
03:21
created

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