Skip to content

Commit

Permalink
remove Interface-Suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
domnikl committed Aug 19, 2019
1 parent 132de8e commit b72515a
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ composer.phar

# translations
*.mo

# general
.DS_Store
2 changes: 1 addition & 1 deletion Behavioral/Command/AddMessageDateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace DesignPatterns\Behavioral\Command;

interface CommandInterface
interface Command
{
/**
* this is the most important method in the Command pattern,
Expand Down
2 changes: 1 addition & 1 deletion Behavioral/Command/HelloCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* 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
Expand Down
6 changes: 3 additions & 3 deletions Behavioral/Command/Invoker.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
class Invoker
{
/**
* @var CommandInterface
* @var Command
*/
private $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 ...
*
* @param CommandInterface $cmd
* @param Command $cmd
*/
public function setCommand(CommandInterface $cmd)
public function setCommand(Command $cmd)
{
$this->command = $cmd;
}
Expand Down
6 changes: 3 additions & 3 deletions Behavioral/Command/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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
.. __: http://en.wikipedia.org/wiki/Command_pattern
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace DesignPatterns\Behavioral\Command;

interface UndoableCommandInterface extends CommandInterface
interface UndoableCommand extends Command
{
/**
* This method is used to undo change made by command execution
Expand Down
70 changes: 42 additions & 28 deletions Behavioral/Command/uml/Command.uml
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
<ID>PHP</ID>
<OriginalElement>\DesignPatterns\Behavioral\Command\HelloCommand</OriginalElement>
<nodes>
<node x="185.0" y="15.0">\DesignPatterns\Behavioral\Command\Invoker</node>
<node x="0.0" y="97.0">\DesignPatterns\Behavioral\Command\HelloCommand</node>
<node x="189.0" y="139.0">\DesignPatterns\Behavioral\Command\Receiver</node>
<node x="10.0" y="0.0">\DesignPatterns\Behavioral\Command\CommandInterface</node>
</nodes>
<notes />
<edges>
<edge source="\DesignPatterns\Behavioral\Command\HelloCommand" target="\DesignPatterns\Behavioral\Command\CommandInterface">
<point x="0.0" y="-44.5" />
<point x="0.0" y="23.5" />
</edge>
</edges>
<settings layout="Hierarchic Group" zoom="1.0" x="171.0" y="93.0" />
<SelectedNodes />
<Categories>
<Category>Fields</Category>
<Category>Constants</Category>
<Category>Constructors</Category>
<Category>Methods</Category>
</Categories>
<VISIBILITY>private</VISIBILITY>
</Diagram>

<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
<ID>PHP</ID>
<OriginalElement>\DesignPatterns\Behavioral\Command\AddMessageDateCommand</OriginalElement>
<nodes>
<node x="0.0" y="246.0">\DesignPatterns\Behavioral\Command\AddMessageDateCommand</node>
<node x="22.5" y="123.0">\DesignPatterns\Behavioral\Command\UndoableCommand</node>
<node x="124.75" y="0.0">\DesignPatterns\Behavioral\Command\Command</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>
<notes />
<edges>
<edge source="\DesignPatterns\Behavioral\Command\HelloCommand" target="\DesignPatterns\Behavioral\Command\Command">
<point x="0.0" y="-48.0" />
<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>
</edges>
<settings layout="Hierarchic Group" zoom="1.0" x="145.0" y="200.5" />
<SelectedNodes />
<Categories>
<Category>Fields</Category>
<Category>Constants</Category>
<Category>Constructors</Category>
<Category>Methods</Category>
</Categories>
<VISIBILITY>private</VISIBILITY>
</Diagram>

Binary file modified Behavioral/Command/uml/uml.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b72515a

Please sign in to comment.