Passed
Push — master ( 5383f1...af8f48 )
by Gabriel
03:29
created

DelegatingLoader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 28.57%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 21
ccs 2
cts 7
cp 0.2857
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A transformCollection() 0 6 1
A load() 0 4 1
1
<?php
2
3
namespace Nip\Router\Loader;
4
5
use Symfony\Component\Config\Loader\DelegatingLoader as SymfonyDirectoryLoader;
6
use Symfony\Component\Routing\RouteCollection;
7
8
/**
9
 * Class DelegatingLoader
10
 * @package Nip\Router\Loader
11
 */
12
class DelegatingLoader extends SymfonyDirectoryLoader
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17 2
    public function load($file, $type = null)
18
    {
19 2
        $collection = parent::load($file, $type);
20
        return $this->transformCollection($collection);
21
    }
22
23
    /**
24
     * @param RouteCollection $symfonyCollection
25
     * @return \Nip\Router\RouteCollection
26
     */
27
    protected function transformCollection(RouteCollection $symfonyCollection)
28
    {
29
        $collection = new \Nip\Router\RouteCollection();
30
        $collection->addCollection($symfonyCollection);
31
32
        return $collection;
33
    }
34
}
35