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.

ApiInitRenderer::render()   B
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 33
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 21
CRAP Score 4

Importance

Changes 0
Metric Value
dl 0
loc 33
ccs 21
cts 21
cp 1
rs 8.5806
c 0
b 0
f 0
cc 4
eloc 24
nc 4
nop 7
crap 4
1
<?php
2
3
/*
4
 * This file is part of the Ivory Google Map package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\GoogleMap\Helper\Renderer;
13
14
/**
15
 * @author GeLo <[email protected]>
16
 */
17
class ApiInitRenderer extends AbstractRenderer
18
{
19
    /**
20
     * @param string            $name
21
     * @param \SplObjectStorage $callbacks
22
     * @param \SplObjectStorage $requirements
23
     * @param string[]          $sources
24
     * @param string            $sourceCallback
25
     * @param string            $requirementCallback
26
     * @param bool              $newLine
27
     *
28
     * @return string
29
     */
30 276
    public function render(
31
        $name,
32
        \SplObjectStorage $callbacks,
33
        \SplObjectStorage $requirements,
34
        array $sources,
35
        $sourceCallback,
36
        $requirementCallback,
37
        $newLine = true
38
    ) {
39 276
        $formatter = $this->getFormatter();
40 276
        $separator = $formatter->renderSeparator();
41 276
        $codes = [];
42
43 276
        foreach ($sources as $source) {
44 52
            $codes[] = $formatter->renderCall($sourceCallback, [$formatter->renderEscape($source)], true);
45 138
        }
46
47 276
        foreach ($callbacks as $object) {
48 276
            $codes[] = $formatter->renderCall($requirementCallback, [
49 276
                $callbacks[$object],
50 276
                $formatter->renderClosure($formatter->renderCode(
51 276
                    'return '.implode(
52 276
                        $separator.'&&'.$separator,
53 276
                        isset($requirements[$object]) ? $requirements[$object] : []
54 138
                    ),
55 276
                    true,
56 138
                    false
57 138
                )),
58 276
            ], true);
59 138
        }
60
61 276
        return $formatter->renderClosure($formatter->renderLines($codes, true, false), [], $name, true, $newLine);
62
    }
63
}
64