feat(shared): add DDD use case contracts
This commit is contained in:
parent
0ebeafeaf1
commit
ec42ef9969
3 changed files with 42 additions and 0 deletions
10
src/Shared/DDD/UseCases/Executor.php
Normal file
10
src/Shared/DDD/UseCases/Executor.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shared\DDD\UseCases;
|
||||
|
||||
interface Executor
|
||||
{
|
||||
public function execute(): object;
|
||||
}
|
||||
19
src/Shared/DDD/UseCases/Presenter.php
Normal file
19
src/Shared/DDD/UseCases/Presenter.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shared\DDD\UseCases;
|
||||
|
||||
/**
|
||||
* @template TOutput of Output
|
||||
*
|
||||
* @template-covariant T of object
|
||||
*/
|
||||
interface Presenter
|
||||
{
|
||||
/**
|
||||
* @param TOutput $output
|
||||
* @return T
|
||||
*/
|
||||
public function present(Output $output): object;
|
||||
}
|
||||
13
src/Shared/DDD/UseCases/Transactional.php
Normal file
13
src/Shared/DDD/UseCases/Transactional.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shared\DDD\UseCases;
|
||||
|
||||
/**
|
||||
* Marker interface for use cases that perform database mutations
|
||||
* requiring an atomic database transaction.
|
||||
*/
|
||||
interface Transactional
|
||||
{
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue