mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-09-25 13:59:08 +02:00
PHP7 Command
This commit is contained in:
@@ -4,18 +4,18 @@ namespace DesignPatterns\Behavioral\Command;
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
/**
|
||||
* @var Receiver
|
||||
*/
|
||||
protected $output;
|
||||
private $output;
|
||||
|
||||
/**
|
||||
* Each concrete command is built with different receivers.
|
||||
* There can be one, many or completely no receivers, but there can be other commands in the parameters.
|
||||
* There can be one, many or completely no receivers, but there can be other commands in the parameters
|
||||
*
|
||||
* @param Receiver $console
|
||||
*/
|
||||
@@ -29,8 +29,7 @@ class HelloCommand implements CommandInterface
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
// sometimes, there is no receiver and this is the command which
|
||||
// does all the work
|
||||
// sometimes, there is no receiver and this is the command which does all the work
|
||||
$this->output->write('Hello World');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user