Passed
Push — dev ( cc9db8...1b0f93 )
by Yan
01:44
created

ColonParser   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDynamicPattern() 0 3 1
A parseMatches() 0 12 2
1
<?php
2
3
namespace Lincable\Parsers;
4
5
class ColonParser extends Parser
6
{
7
    /**
8
     * @inheritdoc
9
     */
10
    protected function parseMatches(array $matches)
11
    {
12
        if (count($matches) > 1) {
13
14
            // Get the last match on array, which contains the
15
            // formatter options.
16
            $formatter = last($matches);
17
            
18
            return $this->callFormatter(...explode(':', $formatter));
0 ignored issues
show
Bug introduced by
explode(':', $formatter) is expanded, but the parameter $name of Lincable\Parsers\Parser::callFormatter() does not expect variable arguments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

18
            return $this->callFormatter(/** @scrutinizer ignore-type */ ...explode(':', $formatter));
Loading history...
19
        }
20
21
        return false;
22
    }
23
24
    /**
25
     * @inheritdoc
26
     */
27
    protected function getDynamicPattern()
28
    {
29
        return '/^\@([a-zA-Z_]+)(?:\<([a-zA-Z0-9_:]+)\>)?$/';
30
    }
31
}