AuthenticationServiceFactory::createService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineModule\Service\Authentication;
6
7
use BadMethodCallException;
8
use DoctrineModule\Service\AbstractFactory;
9
use Interop\Container\ContainerInterface;
10
use Laminas\Authentication\AuthenticationService;
11
use Laminas\ServiceManager\ServiceLocatorInterface;
12
13
/**
14
 * Factory to create authentication service object.
15
 *
16
 * @link    http://www.doctrine-project.org/
17
 */
18
class AuthenticationServiceFactory extends AbstractFactory
19
{
20
    /**
21
     * {@inheritDoc}
22
     */
23 1
    public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
24
    {
25 1
        return new AuthenticationService(
26 1
            $container->get('doctrine.authenticationstorage.' . $this->getName()),
27 1
            $container->get('doctrine.authenticationadapter.' . $this->getName())
28
        );
29
    }
30
31 1
    public function createService(ServiceLocatorInterface $container) : AuthenticationService
32
    {
33 1
        return $this($container, AuthenticationService::class);
34
    }
35
36
    public function getOptionsClass() : string
37
    {
38
        throw new BadMethodCallException('Not implemented');
39
    }
40
}
41