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

AbstractBinaryFunctionOperation::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 9
ccs 4
cts 5
cp 0.8
rs 9.6666
cc 2
eloc 5
nc 2
nop 1
crap 2.032
1
<?php
2
/**
3
 * File was created 07.05.2015 12:08
4
 *
5
 * @author Karsten J. Gerber <[email protected]>
6
 */
7
namespace PeekAndPoke\Component\Psi\Operation;
8
9
use PeekAndPoke\Component\Psi\Interfaces\Functions\BinaryFunctionInterface;
10
11
/**
12
 * AbstractBinaryFunctionOperation
13
 *
14
 * @author Karsten J. Gerber <[email protected]>
15
 */
16
abstract class AbstractBinaryFunctionOperation
17
{
18
    /** @var \Closure|BinaryFunctionInterface */
19
    protected $biFunction;
20
21
    /**
22
     * @param \Closure|BinaryFunctionInterface $biFunction
23
     */
24 18
    public function __construct($biFunction)
25
    {
26 18
        if ($biFunction instanceof BinaryFunctionInterface) {
27
            $this->biFunction = $biFunction;
28
        } else {
29
            // TODO: add a check that this is a \Closure and that is has the correct number of parameters
30 18
            $this->biFunction = $biFunction;
31
        }
32 18
    }
33
}
34