Completed
Push — master ( 36249c...ba9366 )
by Karsten
03:21
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.1481

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 9
ccs 4
cts 6
cp 0.6667
rs 9.6666
cc 2
eloc 5
nc 2
nop 1
crap 2.1481
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