Completed
Push — master ( c9a923...7591c0 )
by Karsten
03:22
created

ParameterizedUnaryFunction   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

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;
9
10
use PeekAndPoke\Component\Psi\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 354
    public function __construct($val, $val2 = null)
28
    {
29 354
        $this->val  = $val;
30 354
        $this->val2 = $val2;
31 354
    }
32
33
    /**
34
     * @return mixed
35
     */
36 342
    public function getValue()
37
    {
38 342
        return $this->val instanceof ValueHolder
39 342
            ? $this->val->getValue()
40 342
            : $this->val;
41
    }
42
43
    /**
44
     * @return mixed
45
     */
46 30
    public function getValue2()
47
    {
48 30
        return $this->val2 instanceof ValueHolder
49 30
            ? $this->val2->getValue()
50 30
            : $this->val2;
51
    }
52
53
    /**
54
     * @param mixed $input
55
     *
56
     * @return null
57
     */
58 6
    public function __invoke($input)
59
    {
60 6
        return null;
61
    }
62
}
63