diff --git a/.gitignore b/.gitignore index 4b0c6de..8b34f04 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ composer.phar # translations *.mo + +# general +.DS_Store diff --git a/Behavioral/Command/AddMessageDateCommand.php b/Behavioral/Command/AddMessageDateCommand.php index e37d0dd..74fc441 100644 --- a/Behavioral/Command/AddMessageDateCommand.php +++ b/Behavioral/Command/AddMessageDateCommand.php @@ -7,7 +7,7 @@ namespace DesignPatterns\Behavioral\Command; * This concrete command tweaks receiver to add current date to messages * invoker just knows that it can call "execute" */ -class AddMessageDateCommand implements UndoableCommandInterface +class AddMessageDateCommand implements UndoableCommand { /** * @var Receiver diff --git a/Behavioral/Command/CommandInterface.php b/Behavioral/Command/Command.php similarity index 89% rename from Behavioral/Command/CommandInterface.php rename to Behavioral/Command/Command.php index db98ef7..9330359 100644 --- a/Behavioral/Command/CommandInterface.php +++ b/Behavioral/Command/Command.php @@ -3,7 +3,7 @@ declare(strict_types=1); namespace DesignPatterns\Behavioral\Command; -interface CommandInterface +interface Command { /** * this is the most important method in the Command pattern, diff --git a/Behavioral/Command/HelloCommand.php b/Behavioral/Command/HelloCommand.php index b5eb316..8b088d1 100644 --- a/Behavioral/Command/HelloCommand.php +++ b/Behavioral/Command/HelloCommand.php @@ -7,7 +7,7 @@ namespace DesignPatterns\Behavioral\Command; * This concrete command calls "print" on the Receiver, but an external * invoker just knows that it can call "execute" */ -class HelloCommand implements CommandInterface +class HelloCommand implements Command { /** * @var Receiver diff --git a/Behavioral/Command/Invoker.php b/Behavioral/Command/Invoker.php index 8c0e3a0..7e1f41e 100644 --- a/Behavioral/Command/Invoker.php +++ b/Behavioral/Command/Invoker.php @@ -10,7 +10,7 @@ namespace DesignPatterns\Behavioral\Command; class Invoker { /** - * @var CommandInterface + * @var Command */ private $command; @@ -18,9 +18,9 @@ class Invoker * in the invoker we find this kind of method for subscribing the command * There can be also a stack, a list, a fixed set ... * - * @param CommandInterface $cmd + * @param Command $cmd */ - public function setCommand(CommandInterface $cmd) + public function setCommand(Command $cmd) { $this->command = $cmd; } diff --git a/Behavioral/Command/README.rst b/Behavioral/Command/README.rst index 1c83577..0af4642 100644 --- a/Behavioral/Command/README.rst +++ b/Behavioral/Command/README.rst @@ -38,9 +38,9 @@ Code You can also find this code on `GitHub`_ -CommandInterface.php +Command.php -.. literalinclude:: CommandInterface.php +.. literalinclude:: Command.php :language: php :linenos: @@ -72,4 +72,4 @@ Tests/CommandTest.php :linenos: .. _`GitHub`: https://github.com/domnikl/DesignPatternsPHP/tree/master/Behavioral/Command -.. __: http://en.wikipedia.org/wiki/Command_pattern \ No newline at end of file +.. __: http://en.wikipedia.org/wiki/Command_pattern diff --git a/Behavioral/Command/UndoableCommandInterface.php b/Behavioral/Command/UndoableCommand.php similarity index 76% rename from Behavioral/Command/UndoableCommandInterface.php rename to Behavioral/Command/UndoableCommand.php index 491d695..ce8de92 100644 --- a/Behavioral/Command/UndoableCommandInterface.php +++ b/Behavioral/Command/UndoableCommand.php @@ -3,7 +3,7 @@ declare(strict_types=1); namespace DesignPatterns\Behavioral\Command; -interface UndoableCommandInterface extends CommandInterface +interface UndoableCommand extends Command { /** * This method is used to undo change made by command execution diff --git a/Behavioral/Command/uml/Command.uml b/Behavioral/Command/uml/Command.uml index 368d5f0..80f06ec 100644 --- a/Behavioral/Command/uml/Command.uml +++ b/Behavioral/Command/uml/Command.uml @@ -1,28 +1,42 @@ - - - PHP - \DesignPatterns\Behavioral\Command\HelloCommand - - \DesignPatterns\Behavioral\Command\Invoker - \DesignPatterns\Behavioral\Command\HelloCommand - \DesignPatterns\Behavioral\Command\Receiver - \DesignPatterns\Behavioral\Command\CommandInterface - - - - - - - - - - - - Fields - Constants - Constructors - Methods - - private - - + + + PHP + \DesignPatterns\Behavioral\Command\AddMessageDateCommand + + \DesignPatterns\Behavioral\Command\AddMessageDateCommand + \DesignPatterns\Behavioral\Command\UndoableCommand + \DesignPatterns\Behavioral\Command\Command + \DesignPatterns\Behavioral\Command\Invoker + \DesignPatterns\Behavioral\Command\HelloCommand + \DesignPatterns\Behavioral\Command\Receiver + + + + + + + + + + + + + + + + + + + + + + + + Fields + Constants + Constructors + Methods + + private + + diff --git a/Behavioral/Command/uml/uml.png b/Behavioral/Command/uml/uml.png index d021750..e95b5ea 100644 Binary files a/Behavioral/Command/uml/uml.png and b/Behavioral/Command/uml/uml.png differ