|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of the Symfony package. |
| 5 | + * |
| 6 | + * (c) Fabien Potencier <[email protected]> |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view the LICENSE |
| 9 | + * file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
| 12 | +namespace Symfony\Component\DependencyInjection\Loader\Configurator; |
| 13 | + |
| 14 | +use Symfony\UX\Toolkit\Command\DebugKitCommand; |
| 15 | +use Symfony\UX\Toolkit\Command\InstallComponentCommand; |
| 16 | +use Symfony\UX\Toolkit\Kit\KitFactory; |
| 17 | +use Symfony\UX\Toolkit\Kit\KitSynchronizer; |
| 18 | +use Symfony\UX\Toolkit\Registry\GitHubRegistry; |
| 19 | +use Symfony\UX\Toolkit\Registry\LocalRegistry; |
| 20 | +use Symfony\UX\Toolkit\Registry\RegistryFactory; |
| 21 | +use Symfony\UX\Toolkit\Registry\Type; |
| 22 | + |
| 23 | +/* |
| 24 | + * @author Hugo Alliaume <[email protected]> |
| 25 | + */ |
| 26 | +return static function (ContainerConfigurator $container): void { |
| 27 | + $container->services() |
| 28 | + // Commands |
| 29 | + |
| 30 | + ->set('.ux_toolkit.command.debug_kit', DebugKitCommand::class) |
| 31 | + ->args([ |
| 32 | + service('.ux_toolkit.kit.kit_factory'), |
| 33 | + ]) |
| 34 | + ->tag('console.command') |
| 35 | + |
| 36 | + ->set('.ux_toolkit.command.install', InstallComponentCommand::class) |
| 37 | + ->args([ |
| 38 | + service('.ux_toolkit.registry.registry_factory'), |
| 39 | + service('filesystem'), |
| 40 | + ]) |
| 41 | + ->tag('console.command') |
| 42 | + |
| 43 | + // Registry |
| 44 | + |
| 45 | + ->set('.ux_toolkit.registry.registry_factory', RegistryFactory::class) |
| 46 | + ->args([ |
| 47 | + service_locator([ |
| 48 | + Type::Local->value => service('.ux_toolkit.registry.local'), |
| 49 | + Type::GitHub->value => service('.ux_toolkit.registry.github'), |
| 50 | + ]), |
| 51 | + ]) |
| 52 | + |
| 53 | + ->set('.ux_toolkit.registry.local', LocalRegistry::class) |
| 54 | + ->args([ |
| 55 | + service('.ux_toolkit.kit.kit_factory'), |
| 56 | + service('filesystem'), |
| 57 | + ]) |
| 58 | + |
| 59 | + ->set('.ux_toolkit.registry.github', GitHubRegistry::class) |
| 60 | + ->args([ |
| 61 | + service('.ux_toolkit.kit.kit_factory'), |
| 62 | + service('filesystem'), |
| 63 | + service('http_client')->nullOnInvalid(), |
| 64 | + ]) |
| 65 | + |
| 66 | + // Kit |
| 67 | + |
| 68 | + ->set('.ux_toolkit.kit.kit_factory', KitFactory::class) |
| 69 | + ->args([ |
| 70 | + service('filesystem'), |
| 71 | + service('.ux_toolkit.kit.kit_synchronizer'), |
| 72 | + ]) |
| 73 | + |
| 74 | + ->set('.ux_toolkit.kit.kit_synchronizer', KitSynchronizer::class) |
| 75 | + ->args([ |
| 76 | + service('filesystem'), |
| 77 | + ]) |
| 78 | + ; |
| 79 | +}; |
0 commit comments