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

Delegate::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 4
rs 10
1
<?php
2
3
namespace ConferenceTools\Checkin\Service\Factory\Projection;
4
5
use ConferenceTools\Checkin\Domain\Projection\Delegate as DelegateProjection;
6
use ConferenceTools\Checkin\Domain\ReadModel\Delegate as DelegateReadModel;
7
use Doctrine\ORM\EntityManager;
8
use Interop\Container\ContainerInterface;
9
use Zend\ServiceManager\FactoryInterface;
10
use Zend\ServiceManager\ServiceLocatorInterface;
11
use Carnage\Cqorms\Persistence\ReadModel\DoctrineRepository;
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
        return new DelegateProjection(
23
            new DoctrineRepository(DelegateReadModel::class, $container->get(EntityManager::class))
24
        );
25
    }
26
}