Ticket   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 12 1
1
<?php
2
3
namespace ConferenceTools\Tickets\Service\Factory\CommandHandler;
4
5
use Carnage\Cqrs\Aggregate\Identity\YouTubeStyleIdentityGenerator;
6
use ConferenceTools\Tickets\Domain\CommandHandler\Ticket as TicketCommandHandler;
7
use ConferenceTools\Tickets\Domain\Model\Ticket\TicketPurchase;
8
use ConferenceTools\Tickets\Domain\Service\Basket\Factory;
9
use ConferenceTools\Tickets\Domain\Service\Basket\ValidateBasket;
10
use ConferenceTools\Tickets\Domain\Service\Configuration;
11
use ConferenceTools\Tickets\Service\Identity\TicketIdentityGenerator;
12
use Zend\ServiceManager\FactoryInterface;
13
use Zend\ServiceManager\ServiceLocatorInterface;
14
use Carnage\Cqrs\Persistence\Repository\PluginManager;
15
16
class Ticket implements FactoryInterface
17
{
18
    public function createService(ServiceLocatorInterface $serviceLocator)
19
    {
20
        $mainServiceLocator = $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

20
        /** @scrutinizer ignore-call */ 
21
        $mainServiceLocator = $serviceLocator->getServiceLocator();
Loading history...
21
        $repositoryManager = $mainServiceLocator->get(PluginManager::class);
22
23
        return new TicketCommandHandler(
24
            new YouTubeStyleIdentityGenerator(),
25
            $repositoryManager->get(TicketPurchase::class),
26
            new Factory(
27
                new TicketIdentityGenerator(),
28
                $mainServiceLocator->get(Configuration::class),
29
                new ValidateBasket()
30
            )
31
        );
32
    }
33
}