Lines
100.00%
13 / 13
Methods
100.00%
1 / 1
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| register | 100.00% | 13 / 13 | 100.00% | 1 / 1 | 4 | ||
| 28 | final class FormsServiceProvider | |
| 29 | { | |
| 30 | public static function register(ContainerBuilder $containerBuilder): void | |
| 31 | { | |
| 32 | // Repository Definition (concrete) | |
| 33 | if (!$containerBuilder->has(FormsRepository::class)) { | |
| 34 | $repoDef = new Definition(FormsRepository::class); | |
| 35 | $repoDef->setArgument(0, new Reference('phpmyfaq.configuration')); | |
| 36 | $repoDef->setPublic(true); | |
| 37 | $containerBuilder->setDefinition(FormsRepository::class, $repoDef); | |
| 38 | } | |
| 39 | ||
| 40 | // Interface Alias -> concrete Repository | |
| 41 | if (!$containerBuilder->has(FormsRepositoryInterface::class)) { | |
| 42 | $containerBuilder->setAlias(FormsRepositoryInterface::class, new Alias(FormsRepository::class, true)); | |
| 43 | } | |
| 44 | ||
| 45 | // Forms service | |
| 46 | if (!$containerBuilder->has(Forms::class)) { | |
| 47 | $formsDef = new Definition(Forms::class); | |
| 48 | $formsDef->setArgument(0, new Reference('phpmyfaq.configuration')); | |
| 49 | $formsDef->setArgument(1, new Reference(FormsRepositoryInterface::class)); | |
| 50 | $formsDef->setPublic(true); | |
| 51 | $containerBuilder->setDefinition(Forms::class, $formsDef); | |
| 52 | } | |
| 53 | } | |
| 54 | } |