Passed
Push — master ( 645913...ffdc3b )
by Chris
03:41
created

Delegate   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 7 1
A createService() 0 3 1
1
<?php
2
3
namespace ConferenceTools\Checkin\Service\Factory\CommandHandler;
4
5
use Carnage\Cqrs\Aggregate\Identity\YouTubeStyleIdentityGenerator;
6
use ConferenceTools\Checkin\Domain\CommandHandler\Delegate as DelegateCommandHandler;
7
use ConferenceTools\Checkin\Domain\Model\Delegate\Delegate as DelegateModel;
8
use Interop\Container\ContainerInterface;
9
use Zend\ServiceManager\FactoryInterface;
10
use Zend\ServiceManager\ServiceLocatorInterface;
11
use Carnage\Cqrs\Persistence\Repository\PluginManager;
12
13
class Delegate implements FactoryInterface
14
{
15
    public function createService(ServiceLocatorInterface $serviceLocator, $cName = null, $rName = null)
16
    {
17
        return $this($serviceLocator->getServiceLocator(), $rName);
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

17
        return $this($serviceLocator->/** @scrutinizer ignore-call */ getServiceLocator(), $rName);
Loading history...
18
    }
19
20
    public function __invoke(ContainerInterface $container, $name, $options = [])
21
    {
22
        $repositoryManager = $container->get(PluginManager::class);
23
24
        return new DelegateCommandHandler(
25
            $repositoryManager->get(DelegateModel::class),
26
            new YouTubeStyleIdentityGenerator()
27
        );
28
29
    }
30
}