Code Duplication    Length = 15-15 lines in 2 locations

Parser/CloseRule.php 1 location

@@ 19-33 (lines=15) @@
16
namespace Kadet\Highlighter\Parser;
17
18
19
class CloseRule extends Rule
20
{
21
    /**
22
     * @param $source
23
     *
24
     * @return Token[]
25
     */
26
    public function match($source)
27
    {
28
        return array_filter(parent::match($source), function (Token $token) {
29
            if ($token->isEnd()) {
30
                $token->setStart(null);
31
32
                return true;
33
            }
34
35
            return false;
36
        });

Parser/OpenRule.php 1 location

@@ 19-33 (lines=15) @@
16
namespace Kadet\Highlighter\Parser;
17
18
19
class OpenRule extends Rule
20
{
21
    /**
22
     * @param $source
23
     *
24
     * @return Token[]
25
     */
26
    public function match($source)
27
    {
28
        return array_filter(parent::match($source), function (Token $token) {
29
            if ($token->isStart()) {
30
                $token->setEnd(null);
31
32
                return true;
33
            }
34
35
            return false;
36
        });