PatternRule   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 21
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
1
<?php
2
3
namespace Bavix\Router\Rules;
4
5
use Bavix\Exceptions\NotFound\Path;
6
use Bavix\Router\Rule;
7
8
class PatternRule extends Rule
9
{
10
11
    /**
12
     * PatternRule constructor.
13
     *
14
     * @param string $key
15
     * @param array $storage
16
     * @param Rule|null $parent
17
     */
18 8
    public function __construct(string $key, array $storage, ?Rule $parent = null)
19
    {
20 8
        parent::__construct($key, $storage, $parent);
21
22 8
        if (!$this->path) {
23 1
            throw new Path(
24 1
                \sprintf(
25 1
                    'No `%s` option found for class `%s` on `%s` route',
26 1
                    'path',
27 1
                    __CLASS__,
28 1
                    $this->getName()
29
                )
30
            );
31
        }
32 7
    }
33
34
}
35