Passed
Push — master ( 4c697a...778310 )
by Kacper
02:53
created

CloseRule   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 75 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 66.67%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 2
c 3
b 0
f 0
lcom 0
cbo 2
dl 15
loc 20
rs 10
ccs 4
cts 6
cp 0.6667

1 Method

Rating   Name   Duplication   Size   Complexity  
A match() 8 12 2

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
 * Highlighter
4
 *1
5
 * Copyright (C) 2015, Some right reserved.
6
 *
7
 * @author Kacper "Kadet" Donat <[email protected]>
8
 *
9
 * Contact with author:
10
 * Xmpp: [email protected]
11
 * E-mail: [email protected]
12
 *
13
 * From Kadet with love.
14
 */
15
16
namespace Kadet\Highlighter\Parser;
17
18
19 View Code Duplication
class CloseRule extends Rule
0 ignored issues
show
Duplication introduced by
This class 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...
20
{
21
    /**
22
     * @param $source
23
     *
24
     * @return Token[]
25
     */
26
    public function match($source)
27
    {
28 1
        return array_filter(parent::match($source), function (Token $token) {
29 1
            if ($token->isEnd()) {
30
                $token->setStart(null);
31
32
                return true;
33
            }
34
35 1
            return false;
36 1
        });
37
    }
38
}