Completed
Push — master ( 38f87f...231e76 )
by Karsten
02:16
created

AbstractParameterizedUnaryFunction   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 2
cbo 2
dl 0
loc 39
ccs 13
cts 13
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getValue() 0 6 2
A getValue2() 0 6 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