RootRouteCollectionFactory::__invoke()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 3
eloc 5
nc 2
nop 1
1
<?php
2
/**
3
 * Dash
4
 *
5
 * @link      http://github.com/DASPRiD/Dash For the canonical source repository
6
 * @copyright 2013-2015 Ben Scholzen 'DASPRiD'
7
 * @license   http://opensource.org/licenses/BSD-2-Clause Simplified BSD License
8
 */
9
10
namespace Dash;
11
12
use Dash\Route\RouteManager;
13
use Dash\RouteCollection\LazyRouteCollection;
14
use Interop\Container\ContainerInterface;
15
16
/**
17
 * Factory for the root route collection.
18
 */
19
class RootRouteCollectionFactory
20
{
21
    /**
22
     * {@inheritdoc}
23
     *
24
     * @return LazyRouteCollection
25
     */
26
    public function __invoke(ContainerInterface $container)
27
    {
28
        $config = $container->has('config') ? $container->get('config') : [];
29
30
        return new LazyRouteCollection(
31
            $container->get(RouteManager::class),
32
            isset($config['dash']['routes']) ? $config['dash']['routes'] : []
33
        );
34
    }
35
}
36