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