Passed
Push — master ( 99f62c...22c5d8 )
by Alex
07:13
created

Router   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 33
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A callRoute() 0 7 2
A getCallback() 0 5 1
1
<?php
2
declare(strict_types = 1);
3
namespace Mezon\Router;
4
5
/**
6
 * Class Router
7
 *
8
 * @package Router
9
 * @author Dodonov A.A.
10
 * @version v.1.0 (2019/08/15)
11
 * @copyright Copyright (c) 2019, http://aeon.su
12
 */
13
14
/**
15
 * Router class
16
 */
17
class Router extends RouterBase implements RouterInterface
18
{
19
20
    use RoutesSet, UrlParser;
21
22
    /**
23
     *
24
     * {@inheritdoc}
25
     * @see RouterInterface::callRoute()
26
     * @psalm-suppress MixedAssignment
27
     */
28
    public function callRoute($route)
29
    {
30
        if (! $this->regExpsWereCompiled) {
31
            $this->compileRegexpForBunches();
32
        }
33
34
        return parent::callRoute($route);
35
    }
36
37
    /**
38
     * Method returns call back by it's router
39
     *
40
     * @param string[]|string $route
41
     *            route
42
     * @return array{0: string, 1: string}|callable|string|false route callback
43
     * @psalm-suppress MixedAssignment
44
     */
45
    public function getCallback($route)
46
    {
47
        $this->compileRegexpForBunches();
48
49
        return parent::getCallback($route);
50
    }
51
}
52