This repository has been archived by the owner on Apr 4, 2019. It is now read-only.
-
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
0 parents
commit 0913269
Showing
17 changed files
with
823 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.idea | ||
.DS_Store | ||
vendor |
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,19 @@ | ||
{ | ||
"name": "mannum/eventor", | ||
"description": "Simple event-sourcing framework for EventStore.", | ||
"keywords": ["event-sourcing"], | ||
|
||
"authors": [ | ||
{ | ||
"name": "Alex Haproff", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"predis/predis": "^1.0", | ||
"guzzlehttp/guzzle": "^6.2" | ||
}, | ||
"autoload": { | ||
"psr-4": {"Eventor\\": "src/Eventor"} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,22 @@ | ||
<?php | ||
namespace Eventor; | ||
|
||
|
||
class CommandBus implements CommandBusInterface | ||
{ | ||
protected $commandHandlers = []; | ||
|
||
public function addCommandHandler($messageName, callable $handler) | ||
{ | ||
$this->commandHandlers[$messageName] = $handler; | ||
} | ||
|
||
public function handle($message) | ||
{ | ||
if (empty($message::$name)) return; | ||
|
||
if (empty($this->commandHandlers[$message::$name])) return; | ||
|
||
$this->commandHandlers[$message::$name]($message); | ||
} | ||
} |
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,12 @@ | ||
<?php | ||
namespace Eventor; | ||
|
||
|
||
interface CommandBusInterface | ||
{ | ||
/** | ||
* @param object $message | ||
* @return void | ||
*/ | ||
public function handle($message); | ||
} |
Oops, something went wrong.