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