For_::getSubNodeNames()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace PhpParser\Node\Stmt;
4
5
use PhpParser\Node;
6
7
class For_ extends Node\Stmt
8
{
9
    /** @var Node\Expr[] Init expressions */
10
    public $init;
11
    /** @var Node\Expr[] Loop conditions */
12
    public $cond;
13
    /** @var Node\Expr[] Loop expressions */
14
    public $loop;
15
    /** @var Node[] Statements */
16
    public $stmts;
17
18
    /**
19
     * Constructs a for loop node.
20
     *
21
     * @param array $subNodes   Array of the following optional subnodes:
22
     *                          'init'  => array(): Init expressions
23
     *                          'cond'  => array(): Loop conditions
24
     *                          'loop'  => array(): Loop expressions
25
     *                          'stmts' => array(): Statements
26
     * @param array $attributes Additional attributes
27
     */
28
    public function __construct(array $subNodes = array(), array $attributes = array()) {
29
        parent::__construct($attributes);
30
        $this->init = isset($subNodes['init']) ? $subNodes['init'] : array();
31
        $this->cond = isset($subNodes['cond']) ? $subNodes['cond'] : array();
32
        $this->loop = isset($subNodes['loop']) ? $subNodes['loop'] : array();
33
        $this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
34
    }
35
36
    public function getSubNodeNames() {
37
        return array('init', 'cond', 'loop', 'stmts');
38
    }
39
}
40