ObjectRadioFactory::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 7
cp 0
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineORMModule\Service;
6
7
use Doctrine\ORM\EntityManager;
8
use DoctrineModule\Form\Element\ObjectRadio;
9
use Interop\Container\ContainerInterface;
10
use Laminas\ServiceManager\FactoryInterface;
11
use Laminas\ServiceManager\ServiceLocatorInterface;
12
13
/**
14
 * Factory for {@see ObjectRadio}
15
 */
16
class ObjectRadioFactory implements FactoryInterface
0 ignored issues
show
Deprecated Code introduced by
The interface Laminas\ServiceManager\FactoryInterface has been deprecated with message: Use Laminas\ServiceManager\Factory\FactoryInterface instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
17
{
18
    /**
19
     * {@inheritDoc}
20
     *
21
     * @return ObjectRadio
22
     */
23
    public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
24
    {
25
        $entityManager = $container->get(EntityManager::class);
26
        $element       = new ObjectRadio();
27
28
        $element->getProxy()->setObjectManager($entityManager);
29
30
        return $element;
31
    }
32
33
    /**
34
     * {@inheritDoc}
35
     */
36
    public function createService(ServiceLocatorInterface $container)
37
    {
38
        return $this($container->getServiceLocator(), ObjectRadio::class);
39
    }
40
}
41