DelegatingLoader::transformCollection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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