DelegatingLoader   A
last analyzed

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