GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 296305...0c25c8 )
by James
02:19
created

BlockDirective::hasDirective()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 16
rs 8.8571
cc 5
eloc 8
nc 5
nop 1
1
<?php
2
3
/**
4
 * This file is part of WebHelper Parser.
5
 *
6
 * (c) James <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WebHelper\Parser\Directive;
13
14
/**
15
 * Describes a directive instance.
16
 *
17
 * a BlockDirective is an ordered list of other directives set in a context.
18
 *
19
 * @author James <[email protected]>
20
 */
21
class BlockDirective extends Directive implements DirectiveInterface
22
{
23
    private $directives = [];
24
25
    /**
26
     * Adds a Directive at the end of the list.
27
     *
28
     * @param DirectiveInterface $directive a directive to add
29
     */
30
    public function add(DirectiveInterface $directive)
31
    {
32
        $this->directives[] = $directive;
33
34
        return $this;
35
    }
36
37
    /**
38
     * Confirms if the directive contains a specified directive.
39
     *
40
     * @param string $name the directive for which to check existence
41
     *
42
     * @return bool true if the sub-directive exists, false otherwise
43
     */
44
    public function hasDirective($name)
45
    {
46
        $inSubDirective = false;
47
48
        foreach ($this->directives as $index => $directive) {
49
            if ($directive->getName() == $name) {
50
                return true;
51
            }
52
53
            if (!$directive->isSimple()) {
54
                $inSubDirective = $inSubDirective || $directive->hasDirective($name);
55
            }
56
        }
57
58
        return $inSubDirective;
59
    }
60
61
    public function isSimple()
62
    {
63
        return false;
64
    }
65
}
66