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

IfControlNode::evaluate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 10
rs 9.9332
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