Completed
Branch master (25a17b)
by Karsten
02:55
created

AbstractParameterisedUnaryFunction   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 83.33%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 5
c 2
b 0
f 2
lcom 2
cbo 2
dl 0
loc 37
ccs 10
cts 12
cp 0.8333
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 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
        $this->val  = $val;
30 161
        $this->val2 = $val2;
31 161
    }
32
33
    /**
34
     * @return mixed
35
     */
36 161
    public function getValue()
37
    {
38 161
        return $this->val instanceof ValueHolderInterface
39
            ? $this->val->getValue()
40 161
            : $this->val;
41
    }
42
43
    /**
44
     * @return mixed
45
     */
46 12
    public function getValue2()
47
    {
48 12
        return $this->val2 instanceof ValueHolderInterface
49
            ? $this->val2->getValue()
50 12
            : $this->val2;
51
    }
52
}
53