ColonParser   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 27
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDynamicPattern() 0 3 1
A __construct() 0 3 1
A parseMatches() 0 3 1
1
<?php
2
3
namespace Lincable\Parsers;
4
5
use Illuminate\Contracts\Container\Container;
6
use Lincable\Contracts\Parsers\ParameterInterface;
7
8
class ColonParser extends Parser
9
{
10
    /**
11
     * Create a new class instance.
12
     *
13
     * @param \Illuminate\Contracts\Container\Container $app
14
     * @return void
15
     */
16 59
    public function __construct(Container $app)
17
    {
18 59
        $this->boot($app);
19 59
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24 37
    protected function parseMatches(array $matches): ParameterInterface
25
    {
26 37
        return new Options(head($matches));
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 42
    protected function getDynamicPattern(): string
33
    {
34 42
        return '/^\:([a-zA-Z_-]+)$/';
35
    }
36
}
37