VisitableArray   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 5
Bugs 4 Features 0
Metric Value
wmc 3
c 5
b 4
f 0
lcom 1
cbo 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A acceptVisitor() 0 9 3
1
<?php
2
3
namespace PEIP\Base;
4
5
/*
6
 * This file is part of the PEIP package.
7
 * (c) 2009-2016 Timo Michna <timomichna/yahoo.de>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
/**
14
 * VisitableArray.
15
 *
16
 * @author Timo Michna <timomichna/yahoo.de>
17
 * @extends RecursiveArrayIterator
18
 * @implements RecursiveIterator, Iterator, Traversable, ArrayAccess, SeekableIterator, Serializable, \PEIP\INF\Base\Visitable
19
 */
20
class VisitableArray extends \RecursiveArrayIterator implements \PEIP\INF\Base\Visitable
21
{
22
    /**
23
     * @param $visitor
24
     *
25
     * @return
26
     */
27
    public function acceptVisitor(\PEIP\INF\Base\Visitor $visitor)
28
    {
29
        if ($this->hasChildren()) {
30
            foreach ($this->getChildren as $child) {
0 ignored issues
show
Bug introduced by
The property getChildren does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
31
                $child->acceptVisitor($visitor);
32
            }
33
        }
34
        $this->acceptVisitor($visitor);
35
    }
36
}
37