-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
154 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
/* | ||
* cqrs (https://github.com/phpgears/cqrs). | ||
* CQRS base. | ||
* | ||
* @license MIT | ||
* @link https://github.com/phpgears/cqrs | ||
* @author Julián Gutiérrez <juliangut@gmail.com> | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Gears\CQRS; | ||
|
||
use Gears\DTO\ScalarPayloadBehaviour; | ||
use Gears\Immutability\ImmutabilityBehaviour; | ||
|
||
/** | ||
* Abstract empty immutable event. | ||
*/ | ||
abstract class AbstractEmptyCommand implements Command | ||
{ | ||
use ImmutabilityBehaviour, ScalarPayloadBehaviour { | ||
ScalarPayloadBehaviour::__call insteadof ImmutabilityBehaviour; | ||
} | ||
|
||
/** | ||
* AbstractEmptyCommand constructor. | ||
*/ | ||
final protected function __construct() | ||
{ | ||
$this->checkImmutability(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
* | ||
* @SuppressWarnings(PHPMD.UnusedFormalParameter) | ||
*/ | ||
final public static function reconstitute(array $parameters) | ||
{ | ||
return new static(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
* | ||
* @return string[] | ||
*/ | ||
final protected function getAllowedInterfaces(): array | ||
{ | ||
return [Command::class]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/* | ||
* cqrs (https://github.com/phpgears/cqrs). | ||
* CQRS base. | ||
* | ||
* @license MIT | ||
* @link https://github.com/phpgears/cqrs | ||
* @author Julián Gutiérrez <juliangut@gmail.com> | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Gears\CQRS\Tests\Stub; | ||
|
||
use Gears\CQRS\AbstractCommandHandler; | ||
use Gears\CQRS\Command; | ||
|
||
/** | ||
* Abstract command handler stub class. | ||
*/ | ||
class AbstractEmptyCommandHandlerStub extends AbstractCommandHandler | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function getSupportedCommandType(): string | ||
{ | ||
return AbstractEmptyCommandStub::class; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function handleCommand(Command $command): void | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/* | ||
* cqrs (https://github.com/phpgears/cqrs). | ||
* CQRS base. | ||
* | ||
* @license MIT | ||
* @link https://github.com/phpgears/cqrs | ||
* @author Julián Gutiérrez <juliangut@gmail.com> | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Gears\CQRS\Tests\Stub; | ||
|
||
use Gears\CQRS\AbstractEmptyCommand; | ||
|
||
/** | ||
* Abstract empty command stub class. | ||
*/ | ||
class AbstractEmptyCommandStub extends AbstractEmptyCommand | ||
{ | ||
/** | ||
* Instantiate command. | ||
* | ||
* @return self | ||
*/ | ||
public static function instance(): self | ||
{ | ||
return new self(); | ||
} | ||
} |