DelegatingLoader::load()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1.125

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 2
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 1
cts 2
cp 0.5
crap 1.125
rs 10
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