Skip to content

Instantly share code, notes, and snippets.

@mdzwigala
Last active December 5, 2020 23:07
Show Gist options
  • Save mdzwigala/619708dd3b5b747b4423b3a17f9a7cfc to your computer and use it in GitHub Desktop.
Save mdzwigala/619708dd3b5b747b4423b3a17f9a7cfc to your computer and use it in GitHub Desktop.
ADR-EXAMPLE\Infrastructure\AddUserInputFactory
<?php
declare(strict_types=1);
namespace App\Infrastructure\ParamConverter\InputFactory;
use App\Action\Input\AddUserInput;
use Symfony\Component\HttpFoundation\Request;
final class AddUserInputFactory implements InputFactory
{
public function createFromRequest(Request $request): AddUserInput
{
return new AddUserInput(
(string)$request->request->get('email', ''),
(string)$request->request->get('password', '')
);
}
public static function supportedInput(): string
{
return AddUserInput::class;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment