Completed
Push — master ( 2e4917...2e950a )
by Klaus
19:05 queued 19:05
created

IfControlNode   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 29
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Linio\Component\RuleEngine\Ast;
6
7
class IfControlNode extends Node
8
{
9
    protected Node $condition;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
10
    protected Node $statement;
11
12
    public function __construct(Node $condition, Node $statement)
13
    {
14
        $this->condition = $condition;
15
        $this->statement = $statement;
16
    }
17
18
    public function evaluate()
19
    {
20
        if ($this->condition->evaluate()) {
21
            $this->statement->evaluate();
22
23
            return true;
24
        }
25
26
        return false;
27
    }
28
}
29