Conditions | 2 |
Paths | 2 |
Total Lines | 30 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 2.0094 |
Changes | 0 |
1 | <?php |
||
24 | 3 | public static function create($purpose, $generator, $duration, $usages, $keep, ContainerBuilder $container) |
|
25 | { |
||
26 | 3 | $id = sprintf('yokai_security_token.configuration.%s', $purpose); |
|
27 | |||
28 | 3 | if ($container->hasDefinition($id)) { |
|
29 | throw new BadMethodCallException( |
||
30 | sprintf( |
||
31 | 'Cannot register service for security token on "%s" purpose.'. |
||
32 | ' A service with id "%s" is already registered.', |
||
33 | $purpose, |
||
34 | $id |
||
35 | ) |
||
36 | ); |
||
37 | } |
||
38 | |||
39 | 3 | $definition = new Definition( |
|
40 | 3 | TokenConfiguration::class, |
|
41 | [ |
||
42 | 3 | $purpose, |
|
43 | 3 | new Reference($generator), |
|
44 | 3 | $duration, |
|
45 | 3 | $usages, |
|
46 | 3 | $keep |
|
47 | ] |
||
48 | ); |
||
49 | |||
50 | 3 | $definition->addTag('yokai_security_token.configuration'); |
|
51 | |||
52 | 3 | $container->setDefinition($id, $definition); |
|
53 | 3 | } |
|
54 | } |
||
55 |