Merge pull request #87 from marcusesa/CommandWithClient

Add Client Class in Command Pattern.
This commit is contained in:
Dominik Liebler 2014-05-18 11:16:24 +02:00
commit df90bc0eff

22
Command/Client.php Normal file
View File

@ -0,0 +1,22 @@
<?php
namespace DesignPatterns\Command;
/**
* Client is responsible for creating a ConcreteCommand and setting its a Receiver
*/
class Client
{
/**
* Creates a ConcreteCommand object, sets its receiver and test invoker
*/
public function run()
{
$receiver = new Receiver();
$helloCommand = new HelloCommand($receiver);
$invoker = new Invoker();
$invoker->setCommand($helloCommand);
$invoker->run();
}
}