Completed
Push — master ( 52213e...a02c72 )
by Matthias
16s queued 11s
created

ControllerServiceFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 10
cts 10
cp 1
rs 9.7333
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
namespace MaglLegacyApplication\Factory;
4
5
use Interop\Container\ContainerInterface;
6
use Laminas\Mvc\MvcEvent;
7
use Laminas\Router\RouteMatch;
8
use Laminas\ServiceManager\Factory\FactoryInterface;
9
use MaglLegacyApplication\Service\ControllerService;
10
11
class ControllerServiceFactory implements FactoryInterface
12
{
13
14
    /**
15
     * @inheritDoc
16
     */
17 1
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
18
    {
19 1
        $eventManager = $container->get('Application')->getEventManager();
20
21 1
        $event = new MvcEvent();
22 1
        $event->setApplication($container->get('Application'));
23 1
        $event->setTarget($container->get('Application'));
24 1
        $event->setRequest($container->get('Request'));
25 1
        $event->setRouter($container->get('Router'));
26
27 1
        $routeMatch = new RouteMatch(array());
28
29 1
        $event->setRouteMatch($routeMatch);
30
31 1
        return new ControllerService($eventManager, $event);
32
    }
33
}
34