ReallySimpleJWTValidateTokenFactory::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Auth\Container;
6
7
use Auth\Infrastructure\Service\ReallySimpleJWTValidateToken;
8
use Auth\Service\ValidateToken;
9
use Interop\Config\ConfigurationTrait;
10
use Interop\Config\RequiresConfig;
11
use Psr\Container\ContainerInterface;
0 ignored issues
show
Bug introduced by
The type Psr\Container\ContainerInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
13
class ReallySimpleJWTValidateTokenFactory implements RequiresConfig
14
{
15
    use ConfigurationTrait;
16
17
    public function __invoke(ContainerInterface $container): ValidateToken
18
    {
19
        $config = $container->get('config')['jwt_auth'];
20
21
        return new ReallySimpleJWTValidateToken(
22
            new TokenConfig(
23
                $config['secret'],
24
                $config['expiration'],
25
                $config['issuer']
26
            )
27
        );
28
    }
29
30
    /**
31
     * @inheritdoc \Interop\Config\RequiresConfig::dimensions
32
     */
33
    public function dimensions(): iterable
34
    {
35
        return ['jwt_auth'];
36
    }
37
}
38