Completed
Push — master ( 984c1e...c9a923 )
by Karsten
03:26
created

ParameterizedUnaryFunction   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
wmc 6
lcom 2
cbo 1
dl 0
loc 47
ccs 12
cts 14
cp 0.8571
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getValue() 0 6 2
A getValue2() 0 6 2
A __invoke() 0 4 1
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\Component\Psi\Interfaces\UnaryFunction;
11
use PeekAndPoke\Types\ValueHolder;
12
13
/**
14
 * @author Karsten J. Gerber <[email protected]>
15
 */
16
class ParameterizedUnaryFunction implements UnaryFunction
17
{
18
    /** @var mixed|ValueHolder */
19
    private $val;
20
    /** @var mixed|ValueHolder */
21
    private $val2;
22
23
    /**
24
     * @param mixed|ValueHolder $val
25
     * @param mixed|ValueHolder $val2
26
     */
27 336
    public function __construct($val, $val2 = null)
28
    {
29 336
        $this->val  = $val;
30 336
        $this->val2 = $val2;
31 336
    }
32
33
    /**
34
     * @return mixed
35
     */
36 336
    public function getValue()
37
    {
38 336
        return $this->val instanceof ValueHolder
39 336
            ? $this->val->getValue()
40 336
            : $this->val;
41
    }
42
43
    /**
44
     * @return mixed
45
     */
46 24
    public function getValue2()
47
    {
48 24
        return $this->val2 instanceof ValueHolder
49 24
            ? $this->val2->getValue()
50 24
            : $this->val2;
51
    }
52
53
    /**
54
     * @param mixed $input
55
     *
56
     * @return null
57
     */
58
    public function __invoke($input)
59
    {
60
        return null;
61
    }
62
}
63