RouteAutoloader   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 23
ccs 0
cts 11
cp 0
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getObblmRoute() 0 6 2
A addObblmRoute() 0 5 1
A getObblmRoutes() 0 3 1
1
<?php
2
3
namespace Obblm\Core\Routing;
4
5
use Exception;
6
7
class RouteAutoloader
8
{
9
    const ROUTE_GLUE = '.';
10
11
    private $routesToLoad = [];
12
13
    public function getObblmRoutes():array
14
    {
15
        return $this->routesToLoad;
16
    }
17
    public function addObblmRoute(AutoloadedRouteInterface $route)
18
    {
19
        $this->routesToLoad[] = [
20
            'resource' => $route->getFileToLoad(),
21
            'type' => $route->getFormat()
22
        ];
23
    }
24
    public function getObblmRoute($key):array
25
    {
26
        if (!isset($this->routesToLoad[$key])) {
27
            throw new Exception('No Service found for ' . $key);
28
        }
29
        return $this->routesToLoad[$key];
30
    }
31
}
32