Completed
Push — master ( 1358d6...984c1e )
by Karsten
01:40
created

AbstractParameterizedUnaryFunction::getValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 3
cts 4
cp 0.75
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
crap 2.0625
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
 * @author Karsten J. Gerber <[email protected]>
14
 */
15
abstract class AbstractParameterizedUnaryFunction extends AbstractUnaryFunction
16
{
17
    /** @var mixed|ValueHolder */
18
    private $val;
19
    /** @var mixed|ValueHolder */
20
    private $val2;
21
22
    /**
23
     * @param mixed|ValueHolder $val
24
     * @param mixed|ValueHolder $val2
25
     */
26 161
    public function __construct($val, $val2 = null)
27
    {
28 161
        parent::__construct();
29
30 161
        $this->val  = $val;
31 161
        $this->val2 = $val2;
32 161
    }
33
34
    /**
35
     * @return mixed
36
     */
37 161
    public function getValue()
38
    {
39 161
        return $this->val instanceof ValueHolder
40
            ? $this->val->getValue()
41 161
            : $this->val;
42
    }
43
44
    /**
45
     * @return mixed
46
     */
47 12
    public function getValue2()
48
    {
49 12
        return $this->val2 instanceof ValueHolder
50
            ? $this->val2->getValue()
51 12
            : $this->val2;
52
    }
53
}
54