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 ( 73195f...eaaffc )
by James
03:05
created

After::deleteBlankLines()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 9.4285
cc 3
eloc 6
nc 3
nop 1
crap 3
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\Parser;
13
14
/**
15
 * Methods that can be applied depending of the kind of server after a parsed configuration file turns into an array.
16
 *
17
 * @author James <[email protected]>
18
 */
19
class After
20
{
21
    /**
22
     * Trim all blank lines.
23
     *
24
     * @param array $activeConfig config file exploded in an array of lines
25
     *
26
     * @return array an array cleaned of blank lines
27
     */
28 11
    public static function deleteBlankLines(array $activeConfig = array())
29
    {
30 11
        $cleanedActiveConfig = [];
31
32 11
        foreach (array_map('trim', $activeConfig) as $line) {
33 11
            if ($line != '') {
34 9
                $cleanedActiveConfig[] = $line;
35 9
            }
36 11
        }
37
38 11
        return $cleanedActiveConfig;
39
    }
40
41
    /**
42
     * Reassembles discontinued simple directives in one line.
43
     *
44
     * In an Apache server context, it may be encountered.
45
     *
46
     * @param array $activeConfig config file exploded in an array of lines
47
     *
48
     * @return array an array cleaned of blank lines
49
     */
50 5
    public static function continuingDirectives(array $activeConfig = array())
51
    {
52 5
        $cleanedActiveConfig = [];
53
54
        //Continuing directives with "\" at the very end of a line are reassembled
55 5
        $previousLine = '';
56 5
        foreach ($activeConfig as $line) {
57 5
            if ($previousLine) {
58 1
                $line = $previousLine.' '.trim($line);
59 1
                $previousLine = '';
60 1
            }
61
62 5
            if (preg_match('/(.+)\\\$/', $line, $container)) {
63 1
                $previousLine = $container[1];
64 1
            }
65
66 5
            if (!$previousLine) {
67 5
                $cleanedActiveConfig[] = $line;
68 5
            }
69 5
        }
70
71 5
        return $cleanedActiveConfig;
72
    }
73
}
74