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

Before   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 41.18 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 0
dl 14
loc 34
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A deleteComments() 7 7 1
A bracesPlacedOnePerLine() 7 7 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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 before a parsed configuration file turns into an array.
16
 *
17
 * @author James <[email protected]>
18
 */
19
class Before
20
{
21
    /**
22
     * Deletes commented lines and end line comments.
23
     *
24
     * @param string $config a file content
25
     *
26
     * @return string a file content without comments
27
     */
28 11 View Code Duplication
    public static function deleteComments($config = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
    {
30 11
        $config = preg_replace('/^\s*#.*/m', '', $config);
31 11
        $config = preg_replace('/^([^#]+)#.*/m', '$1', $config);
32
33 11
        return $config;
34
    }
35
36
    /**
37
     * Sets starting and endind directives in a line.
38
     *
39
     * For convinience, in nginx configuration context, braces are placed one per line
40
     *
41
     * @param string $config a file content
42
     *
43
     * @return string a file content without comments
44
     */
45 2 View Code Duplication
    public static function bracesPlacedOnePerLine($config = '')
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
46
    {
47 2
        $config = preg_replace('/\{\n?/m', "{\n", $config);
48 2
        $config = preg_replace('/\n?\}/m', "\n}", $config);
49
50 2
        return $config;
51
    }
52
}
53