php-kafka/php-avro-schema-generator

View on GitHub
src/ServiceProvider/CommandServiceProvider.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

declare(strict_types=1);

namespace PhpKafka\PhpAvroSchemaGenerator\ServiceProvider;

use PhpKafka\PhpAvroSchemaGenerator\Command\SchemaGenerateCommand;
use PhpKafka\PhpAvroSchemaGenerator\Command\SubSchemaMergeCommand;
use PhpKafka\PhpAvroSchemaGenerator\Generator\SchemaGeneratorInterface;
use PhpKafka\PhpAvroSchemaGenerator\Merger\SchemaMergerInterface;
use PhpKafka\PhpAvroSchemaGenerator\Registry\ClassRegistryInterface;
use PhpKafka\PhpAvroSchemaGenerator\Registry\SchemaRegistryInterface;
use Pimple\Container;
use Pimple\ServiceProviderInterface;

class CommandServiceProvider implements ServiceProviderInterface
{
    public function register(Container $container): void
    {
        $container['console.commands'] = function () use ($container): array {
            $commands = [];

            $commands[SchemaGenerateCommand::class] = new SchemaGenerateCommand(
                $container[ClassRegistryInterface::class],
                $container[SchemaGeneratorInterface::class]
            );

            $commands[SubSchemaMergeCommand::class] = new SubSchemaMergeCommand(
                $container[SchemaMergerInterface::class],
                $container[SchemaRegistryInterface::class]
            );

            return $commands;
        };
    }
}