Completed
Push — master ( 1358d6...984c1e )
by Karsten
01:40
created

AbstractParameterizedUnaryFunction   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 84.62%

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 11
cts 13
cp 0.8462
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
 * @author Karsten J. Gerber <[email protected]>
14
 */
15
abstract class AbstractParameterizedUnaryFunction extends AbstractUnaryFunction
16
{
17
    /** @var mixed|ValueHolder */
18
    private $val;
19
    /** @var mixed|ValueHolder */
20
    private $val2;
21
22
    /**
23
     * @param mixed|ValueHolder $val
24
     * @param mixed|ValueHolder $val2
25
     */
26 161
    public function __construct($val, $val2 = null)
27
    {
28 161
        parent::__construct();
29
30 161
        $this->val  = $val;
31 161
        $this->val2 = $val2;
32 161
    }
33
34
    /**
35
     * @return mixed
36
     */
37 161
    public function getValue()
38
    {
39 161
        return $this->val instanceof ValueHolder
40
            ? $this->val->getValue()
41 161
            : $this->val;
42
    }
43
44
    /**
45
     * @return mixed
46
     */
47 12
    public function getValue2()
48
    {
49 12
        return $this->val2 instanceof ValueHolder
50
            ? $this->val2->getValue()
51 12
            : $this->val2;
52
    }
53
}
54