Completed
Pull Request — master (#8)
by
unknown
02:31 queued 01:21
created

ControllerServiceFactory::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
18
    {
19
        $eventManager = $container->get('Application')->getEventManager();
20
21
        $event = new MvcEvent();
22
        $event->setApplication($container->get('Application'));
23
        $event->setTarget($container->get('Application'));
24
        $event->setRequest($container->get('Request'));
25
        $event->setRouter($container->get('Router'));
26
27
        $routeMatch = new RouteMatch(array());
28
29
        $event->setRouteMatch($routeMatch);
30
31
        return new ControllerService($eventManager, $event);
32
    }
33
}
34