mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-27 18:20:22 +02:00
remove Interface-Suffix
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -15,3 +15,6 @@ composer.phar
|
|||||||
|
|
||||||
# translations
|
# translations
|
||||||
*.mo
|
*.mo
|
||||||
|
|
||||||
|
# general
|
||||||
|
.DS_Store
|
||||||
|
@@ -7,7 +7,7 @@ namespace DesignPatterns\Behavioral\Command;
|
|||||||
* This concrete command tweaks receiver to add current date to messages
|
* This concrete command tweaks receiver to add current date to messages
|
||||||
* invoker just knows that it can call "execute"
|
* invoker just knows that it can call "execute"
|
||||||
*/
|
*/
|
||||||
class AddMessageDateCommand implements UndoableCommandInterface
|
class AddMessageDateCommand implements UndoableCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var Receiver
|
* @var Receiver
|
||||||
|
@@ -3,7 +3,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace DesignPatterns\Behavioral\Command;
|
namespace DesignPatterns\Behavioral\Command;
|
||||||
|
|
||||||
interface CommandInterface
|
interface Command
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* this is the most important method in the Command pattern,
|
* this is the most important method in the Command pattern,
|
@@ -7,7 +7,7 @@ namespace DesignPatterns\Behavioral\Command;
|
|||||||
* This concrete command calls "print" on the Receiver, but an external
|
* This concrete command calls "print" on the Receiver, but an external
|
||||||
* invoker just knows that it can call "execute"
|
* invoker just knows that it can call "execute"
|
||||||
*/
|
*/
|
||||||
class HelloCommand implements CommandInterface
|
class HelloCommand implements Command
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var Receiver
|
* @var Receiver
|
||||||
|
@@ -10,7 +10,7 @@ namespace DesignPatterns\Behavioral\Command;
|
|||||||
class Invoker
|
class Invoker
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var CommandInterface
|
* @var Command
|
||||||
*/
|
*/
|
||||||
private $command;
|
private $command;
|
||||||
|
|
||||||
@@ -18,9 +18,9 @@ class Invoker
|
|||||||
* in the invoker we find this kind of method for subscribing the command
|
* in the invoker we find this kind of method for subscribing the command
|
||||||
* There can be also a stack, a list, a fixed set ...
|
* 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;
|
$this->command = $cmd;
|
||||||
}
|
}
|
||||||
|
@@ -38,9 +38,9 @@ Code
|
|||||||
|
|
||||||
You can also find this code on `GitHub`_
|
You can also find this code on `GitHub`_
|
||||||
|
|
||||||
CommandInterface.php
|
Command.php
|
||||||
|
|
||||||
.. literalinclude:: CommandInterface.php
|
.. literalinclude:: Command.php
|
||||||
:language: php
|
:language: php
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace DesignPatterns\Behavioral\Command;
|
namespace DesignPatterns\Behavioral\Command;
|
||||||
|
|
||||||
interface UndoableCommandInterface extends CommandInterface
|
interface UndoableCommand extends Command
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* This method is used to undo change made by command execution
|
* This method is used to undo change made by command execution
|
@@ -1,21 +1,35 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Diagram>
|
<Diagram>
|
||||||
<ID>PHP</ID>
|
<ID>PHP</ID>
|
||||||
<OriginalElement>\DesignPatterns\Behavioral\Command\HelloCommand</OriginalElement>
|
<OriginalElement>\DesignPatterns\Behavioral\Command\AddMessageDateCommand</OriginalElement>
|
||||||
<nodes>
|
<nodes>
|
||||||
<node x="185.0" y="15.0">\DesignPatterns\Behavioral\Command\Invoker</node>
|
<node x="0.0" y="246.0">\DesignPatterns\Behavioral\Command\AddMessageDateCommand</node>
|
||||||
<node x="0.0" y="97.0">\DesignPatterns\Behavioral\Command\HelloCommand</node>
|
<node x="22.5" y="123.0">\DesignPatterns\Behavioral\Command\UndoableCommand</node>
|
||||||
<node x="189.0" y="139.0">\DesignPatterns\Behavioral\Command\Receiver</node>
|
<node x="124.75" y="0.0">\DesignPatterns\Behavioral\Command\Command</node>
|
||||||
<node x="10.0" y="0.0">\DesignPatterns\Behavioral\Command\CommandInterface</node>
|
<node x="0.0" y="409.0">\DesignPatterns\Behavioral\Command\Invoker</node>
|
||||||
|
<node x="177.5" y="100.0">\DesignPatterns\Behavioral\Command\HelloCommand</node>
|
||||||
|
<node x="402.5" y="0.0">\DesignPatterns\Behavioral\Command\Receiver</node>
|
||||||
</nodes>
|
</nodes>
|
||||||
<notes />
|
<notes />
|
||||||
<edges>
|
<edges>
|
||||||
<edge source="\DesignPatterns\Behavioral\Command\HelloCommand" target="\DesignPatterns\Behavioral\Command\CommandInterface">
|
<edge source="\DesignPatterns\Behavioral\Command\HelloCommand" target="\DesignPatterns\Behavioral\Command\Command">
|
||||||
<point x="0.0" y="-44.5" />
|
<point x="0.0" y="-48.0" />
|
||||||
<point x="0.0" y="23.5" />
|
<point x="267.5" y="75.0" />
|
||||||
|
<point x="205.75" y="75.0" />
|
||||||
|
<point x="27.0" y="25.0" />
|
||||||
|
</edge>
|
||||||
|
<edge source="\DesignPatterns\Behavioral\Command\UndoableCommand" target="\DesignPatterns\Behavioral\Command\Command">
|
||||||
|
<point x="0.0" y="-25.0" />
|
||||||
|
<point x="90.0" y="75.0" />
|
||||||
|
<point x="151.75" y="75.0" />
|
||||||
|
<point x="-27.0" y="25.0" />
|
||||||
|
</edge>
|
||||||
|
<edge source="\DesignPatterns\Behavioral\Command\AddMessageDateCommand" target="\DesignPatterns\Behavioral\Command\UndoableCommand">
|
||||||
|
<point x="0.0" y="-59.0" />
|
||||||
|
<point x="0.0" y="25.0" />
|
||||||
</edge>
|
</edge>
|
||||||
</edges>
|
</edges>
|
||||||
<settings layout="Hierarchic Group" zoom="1.0" x="171.0" y="93.0" />
|
<settings layout="Hierarchic Group" zoom="1.0" x="145.0" y="200.5" />
|
||||||
<SelectedNodes />
|
<SelectedNodes />
|
||||||
<Categories>
|
<Categories>
|
||||||
<Category>Fields</Category>
|
<Category>Fields</Category>
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 75 KiB |
Reference in New Issue
Block a user