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.

Before::bracesPlacedOnePerLine()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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
namespace WebHelper\Parser\Parser;
12
13
/**
14
 * Methods that can be applied depending of the kind of server before a parsed configuration file turns into an array.
15
 *
16
 * @author James <[email protected]>
17
 */
18
class Before
19
{
20
    /**
21
     * Deletes commented lines and end line comments.
22
     *
23
     * @param string $config a file content
24
     *
25
     * @return string a file content without comments
26
     */
27 14
    public static function deleteComments($config = '')
28
    {
29 14
        $config = preg_replace('/^\\s*([^#]+)?#.*/m', '$1', $config);
30
31 14
        return $config;
32
    }
33
34
    /**
35
     * Sets starting and endind directives in a line.
36
     *
37
     * For convinience, in nginx configuration context, braces are placed one per line
38
     *
39
     * @param string $config a file content
40
     *
41
     * @return string a file content without comments
42
     */
43 2
    public static function bracesPlacedOnePerLine($config = '')
44
    {
45 2
        $config = preg_replace(['/\{\n?/m', '/\n?\}/m'], ["{\n", "\n}"], $config);
46
47 2
        return $config;
48
    }
49
}
50