-
Notifications
You must be signed in to change notification settings - Fork 1
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
33 changed files
with
526 additions
and
827 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
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,26 @@ | ||
<?php | ||
|
||
namespace Example; | ||
|
||
use Equip\Command\CommandImmutableOptionsTrait; | ||
use Equip\Command\CommandInterface; | ||
|
||
class ExampleCommand implements CommandInterface | ||
{ | ||
use CommandImmutableOptionsTrait; | ||
|
||
/** | ||
* @var ExampleOptions | ||
*/ | ||
private $options; | ||
|
||
public function withOptions(ExampleOptions $options) | ||
{ | ||
return $this->copyWithOptions($options); | ||
} | ||
|
||
public function execute() | ||
{ | ||
var_dump($this->options, $this->options->test()); | ||
} | ||
} |
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,14 @@ | ||
<?php | ||
|
||
namespace Example; | ||
|
||
use Equip\Command\OptionsInterface; | ||
use Equip\Command\OptionsSerializerTrait; | ||
|
||
class ExampleOptions implements OptionsInterface | ||
{ | ||
public function test() | ||
{ | ||
return 'example'; | ||
} | ||
} |
This file was deleted.
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
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,34 @@ | ||
<?php | ||
|
||
namespace Equip\Queue\Command; | ||
|
||
use Auryn\Injector; | ||
use Equip\Command\CommandInterface; | ||
use Equip\Queue\Exception\CommandException; | ||
|
||
class AurynCommandFactory implements CommandFactoryInterface | ||
{ | ||
/** | ||
* @var Injector | ||
*/ | ||
private $injector; | ||
|
||
public function __construct(Injector $injector) | ||
{ | ||
$this->injector = $injector; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function make($command) | ||
{ | ||
$command = $this->injector->make($command); | ||
|
||
if (!is_a($command, CommandInterface::class)) { | ||
throw CommandException::invalidCommand($command); | ||
} | ||
|
||
return $command; | ||
} | ||
} |
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 Equip\Queue\Command; | ||
|
||
use Equip\Command\CommandInterface; | ||
use Equip\Queue\Exception\CommandException; | ||
use Equip\Queue\Exception\HandlerException; | ||
|
||
interface CommandFactoryInterface | ||
{ | ||
/** | ||
* Instantiates a command object | ||
* | ||
* @param string $command | ||
* | ||
* @return CommandInterface | ||
* | ||
* @throws CommandException If command class doesn't exist | ||
* @throws CommandException If command is not an instance of CommandInterface | ||
*/ | ||
public function make($command); | ||
} |
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
Oops, something went wrong.