DelegatingLoader::load()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the takeit/AmpHtmlBundle package.
5
 *
6
 * (c) Rafał Muszyński <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Takeit\Bundle\AmpHtmlBundle\Routing\Loader;
13
14
use Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader as BaseLoader;
15
use Symfony\Component\Routing\RouteCollection;
16
17
/**
18
 * DelegatingLoader extends default Symfony Framework Bundle Loader.
19
 * It is extended to load AMP HTML route. By using this loader there is no
20
 * need to require AmpLoader config in routing.yml file.
21
 */
22
class DelegatingLoader extends BaseLoader
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function load($resource, $type = null)
28
    {
29
        /** @var RouteCollection $collection */
30
        $collection = parent::load($resource, $type);
31
        $ampCollection = parent::load('.', 'amp');
32
        $collection->addCollection($ampCollection);
33
34
        return $collection;
35
    }
36
}
37