RoutesControllerFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 19
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 11 1
1
<?php
2
/**
3
 * ZfDebugModule. WebUI and Console commands for debugging ZF2 apps.
4
 *
5
 * @license http://www.opensource.org/licenses/mit-license.html MIT License
6
 * @copyright 2016 Vítor Brandão <[email protected]>
7
 */
8
9
namespace Noiselabs\ZfDebugModule\Factory\Controller\Http;
10
11
use Noiselabs\ZfDebugModule\Controller\Http\RoutesController;
12
use Noiselabs\ZfDebugModule\Factory\Util\Routing\RouteCollectionFactory;
13
use Noiselabs\ZfDebugModule\Factory\Util\Routing\RouteMatcherFactory;
14
use Noiselabs\ZfDebugModule\Util\Routing\RouteCollection;
15
use Noiselabs\ZfDebugModule\Util\Routing\RouteMatcher;
16
use Zend\Mvc\Controller\ControllerManager;
17
use Zend\ServiceManager\FactoryInterface;
18
use Zend\ServiceManager\ServiceLocatorInterface;
19
20
/**
21
 * Http\RoutesControllerFactory creates instances of Http\RoutesController.
22
 */
23
class RoutesControllerFactory implements FactoryInterface
24
{
25
    const SERVICE_NAME = RoutesController::class;
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 5
    public function createService(ServiceLocatorInterface $serviceLocator)
31
    {
32
        /* @var ControllerManager $serviceLocator */
33 5
        $mainServiceLocator = $serviceLocator->getServiceLocator();
34
        /** @var RouteCollection $routeCollection */
35 5
        $routeCollection = $mainServiceLocator->get(RouteCollectionFactory::SERVICE_NAME);
36
        /** @var RouteMatcher $routeMatcher */
37 5
        $routeMatcher = $mainServiceLocator->get(RouteMatcherFactory::SERVICE_NAME);
38
39 5
        return new RoutesController($routeCollection, $routeMatcher);
40
    }
41
}
42