TokenResourceMiddlewareFactory::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DataFlowServer\Authentication\Factory;
5
6
use Interop\Container\ContainerInterface;
7
use Psr\Log\LoggerInterface;
8
use SlayerBirden\DataFlowServer\Authentication\Entities\Token;
9
use SlayerBirden\DataFlowServer\Doctrine\Middleware\BaseResourceMiddleware;
10
use SlayerBirden\DataFlowServer\Doctrine\Persistence\EntityManagerRegistry;
11
use Zend\ServiceManager\Factory\FactoryInterface;
12
13
final class TokenResourceMiddlewareFactory implements FactoryInterface
14
{
15
    /**
16
     * @inheritdoc
17
     */
18 6
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
19
    {
20 6
        return new BaseResourceMiddleware(
21 6
            $container->get(EntityManagerRegistry::class),
22 6
            $container->get(LoggerInterface::class),
23 6
            Token::class,
24 6
            'token'
25
        );
26
    }
27
}
28