pheature-flags/toggle-crud-psr7-api

View on GitHub
src/PostFeatureFactory.php

Summary

Maintainability
A
1 hr
Test Coverage
<?php

declare(strict_types=1);

namespace Pheature\Crud\Psr7\Toggle;

use Pheature\Crud\Toggle\Handler\CreateFeature;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseFactoryInterface;

final class PostFeatureFactory
{
    public function __invoke(ContainerInterface $container): PostFeature
    {
        /** @var CreateFeature $createFeature */
        $createFeature = $container->get(CreateFeature::class);
        /** @var ResponseFactoryInterface $responseFactory */
        $responseFactory = $container->get(ResponseFactoryInterface::class);

        return self::create($createFeature, $responseFactory);
    }

    public static function create(CreateFeature $createFeature, ResponseFactoryInterface $responseFactory): PostFeature
    {
        return new PostFeature($createFeature, $responseFactory);
    }
}