Completed
Push — master ( 5a7e4d...40d001 )
by Sebastian
04:05
created

RendersEmptyVariablesTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A rendersEmptyVariables() 0 10 3
1
<?php
2
/*
3
 * citeproc-php
4
 *
5
 * @link        http://github.com/seboettg/citeproc-php for the source repository
6
 * @copyright   Copyright (c) 2017 Sebastian Böttger.
7
 * @license     https://opensource.org/licenses/MIT
8
 */
9
10
namespace Seboettg\CiteProc\Rendering;
11
12
13
trait RendersEmptyVariablesTrait
14
{
15
16
    public function rendersEmptyVariables($data)
17
    {
18
        $allEmpty = 1;
19
        foreach ($this->children as $child) {
0 ignored issues
show
Bug introduced by
The property children 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...
20
            if ($child instanceof RendersEmptyVariables) {
21
                $allEmpty &= $child->rendersEmptyVariables($data);
22
            }
23
        }
24
        return boolval($allEmpty);
25
    }
26
}