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 ( 72f380...b3f20b )
by James
02:32
created

Dumper::dump()   B

Complexity

Conditions 4
Paths 3

Size

Total Lines 30
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 25
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 30
ccs 25
cts 25
cp 1
rs 8.5806
cc 4
eloc 24
nc 3
nop 2
crap 4
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;
13
14
use WebHelper\Parser\Server\ServerInterface;
15
use WebHelper\Parser\Directive\DirectiveInterface;
16
use WebHelper\Parser\Directive\InclusionDirective;
17
18
/**
19
 * Web server configuration generic dumper.
20
 *
21
 * @author James <[email protected]>
22
 */
23
class Dumper
24
{
25
    /** @var Server\ServerInterface a server instance */
26
    private $server;
27
28
    /** @var int number of spaces to indent */
29
    private $indentation = 4;
30
31
    /**
32
     * Setter for the server instance.
33
     *
34
     * @see Server\ServerInterface Server Documentation
35
     *
36
     * @param Server\ServerInterface $server the server instance
37
     */
38 1
    public function setServer(ServerInterface $server)
39
    {
40 1
        $this->server = $server;
41
42 1
        return $this;
43
    }
44
45
    /**
46
     * Dumps recursively the active configuration as a file.
47
     *
48
     * @param DirectiveInterface $activeConfig the active configuration to dump
49
     * @param int                $spaces       the indentation spaces
50
     *
51
     * @return string the file output
52
     */
53 1
    public function dump(DirectiveInterface $activeConfig, $spaces = 0)
54
    {
55 1
        $config = '';
56
57 1
        foreach ($activeConfig as $directive) {
0 ignored issues
show
Bug introduced by
The expression $activeConfig of type object<WebHelper\Parser\...ive\DirectiveInterface> is not traversable.
Loading history...
58 1
            if ($directive->isSimple() || $directive instanceof InclusionDirective) {
59 1
                $config .= str_repeat(' ', $spaces).
60 1
                    sprintf(
61 1
                        $this->server->getDumperSimpleDirective(),
62 1
                        $directive->getName(),
63 1
                        $directive->getValue()
64 1
                    ).PHP_EOL;
65 1
            } else {
66 1
                $config .= str_repeat(' ', $spaces).
67 1
                    sprintf(
68 1
                        $this->server->getDumperStartDirective(),
69 1
                        $directive->getName(),
70 1
                        $directive->getValue()
71 1
                    ).PHP_EOL;
72 1
                $config .= str_repeat(' ', $spaces).$this->dump($directive, $spaces + $this->indentation);
73 1
                $config .= str_repeat(' ', $spaces).
74 1
                    sprintf(
75 1
                        $this->server->getDumperEndDirective(),
76 1
                        $directive->getName()
77 1
                    ).PHP_EOL;
78
            }
79 1
        }
80
81 1
        return $config;
82
    }
83
}
84