CMSRouteLoader   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 18 2
A supports() 0 4 1
1
<?php
2
3
namespace Alpixel\Bundle\CMSBundle\Routing;
4
5
use Symfony\Component\Config\Loader\Loader;
6
use Symfony\Component\Routing\RouteCollection;
7
8
/**
9
 * @author Benjamin HUBERT <[email protected]>
10
 */
11
class CMSRouteLoader extends Loader
12
{
13
    private $loaded = false;
14
15
    public function load($resource, $type = null)
16
    {
17
        if (true === $this->loaded) {
18
            throw new \RuntimeException('Do not add the "alpixel_cms" loader twice');
19
        }
20
21
        $collection = new RouteCollection();
22
23
        $resource = '@AlpixelCMSBundle/Resources/config/routing.yml';
24
        $type = 'yaml';
25
26
        $importedRoutes = $this->import($resource, $type);
27
        $collection->addCollection($importedRoutes);
28
29
        $this->loaded = true;
30
31
        return $collection;
32
    }
33
34
    public function supports($resource, $type = null)
35
    {
36
        return 'alpixel_cms' === $type;
37
    }
38
}
39