CustomizableMinimalConverter::onCloseOr()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * CustomizableMinimalConverter
4
 *
5
 * @package php-logical-filter
6
 * @author  Jean Claveau
7
 */
8
namespace JClaveau\LogicalFilter\Converter;
9
10
/**
11
 * This class implements a converter using callbacks for every pseudo-event
12
 * related to the rules parsing.
13
 */
14
class CustomizableMinimalConverter extends MinimalConverter
15
{
16
    /** @var protected array $callbacks */
17
    protected $callbacks = [];
18
19
    /**
20
     */
21 1
    public function __construct(
22
        callable $onOpenOr,
23
        callable $onAndPossibility,
24
        callable $onCloseOr
25
    ) {
26 1
        $this->callbacks = get_defined_vars();
0 ignored issues
show
Documentation Bug introduced by
It seems like get_defined_vars() of type array is incompatible with the declared type object<JClaveau\LogicalF...er\Converter\protected> of property $callbacks.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
27 1
    }
28
29
    /**
30
     */
31 1
    public function onOpenOr()
32
    {
33 1
        call_user_func( $this->callbacks[ __FUNCTION__ ] );
34 1
    }
35
36
    /**
37
     */
38 1
    public function onCloseOr()
39
    {
40 1
        call_user_func( $this->callbacks[ __FUNCTION__ ] );
41 1
    }
42
43
    /**
44
     * Pseudo-event called while for each And operand of the root Or.
45
     * These operands must be only atomic Rules.
46
     */
47 1
    public function onAndPossibility($field, $operator, $operand, array $allOperandsByField)
48
    {
49 1
        call_user_func(
50 1
            $this->callbacks[ __FUNCTION__ ],
51 1
            $field,
52 1
            $operator,
53 1
            $operand,
54
            $allOperandsByField
55 1
        );
56 1
    }
57
58
    /**/
59
}
60