mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-02-24 01:32:22 +01:00
Merge pull request #87 from marcusesa/CommandWithClient
Add Client Class in Command Pattern.
This commit is contained in:
commit
df90bc0eff
22
Command/Client.php
Normal file
22
Command/Client.php
Normal 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();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user