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

AbstractParameterisedUnaryFunction   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 1
Metric Value
wmc 5
c 1
b 0
f 1
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
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