ControllerFactory::createService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 3
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace ConferenceTools\Tickets\Service\Factory;
3
4
use Carnage\Cqrs\Command\CommandBusInterface;
5
use ConferenceTools\Tickets\Domain\Service\Availability\DiscountCodeAvailability;
6
use ConferenceTools\Tickets\Domain\Service\Configuration;
7
use ConferenceTools\Tickets\Domain\Service\Availability\TicketAvailability;
8
use Zend\ServiceManager\FactoryInterface;
9
use Zend\ServiceManager\ServiceLocatorInterface;
10
use ZfrStripe\Client\StripeClient;
11
12
class ControllerFactory implements FactoryInterface
13
{
14
    public function createService(ServiceLocatorInterface $serviceLocator, $name = null, $requestedName = null)
15
    {
16
        $serviceLocator = $serviceLocator->getServiceLocator();
0 ignored issues
show
Bug introduced by
The method getServiceLocator() does not exist on Zend\ServiceManager\ServiceLocatorInterface. It seems like you code against a sub-type of Zend\ServiceManager\ServiceLocatorInterface such as Zend\ServiceManager\AbstractPluginManager. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
        /** @scrutinizer ignore-call */ 
17
        $serviceLocator = $serviceLocator->getServiceLocator();
Loading history...
17
        return new $requestedName(
18
            $serviceLocator->get(CommandBusInterface::class),
19
            $serviceLocator->get('doctrine.entitymanager.orm_default'),
20
            $serviceLocator->get(StripeClient::class),
21
            $serviceLocator->get(Configuration::class),
22
            $serviceLocator->get(TicketAvailability::class),
23
            $serviceLocator->get(DiscountCodeAvailability::class),
24
            $serviceLocator->get('FormElementManager')
25
        );
26
    }
27
}
28