Skip to content

Commit df90bc0

Browse files
author
Dominik Liebler
committed
Merge pull request DesignPatternsPHP#87 from marcusesa/CommandWithClient
Add Client Class in Command Pattern.
2 parents 4aedcff + 7f3856f commit df90bc0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Command/Client.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace DesignPatterns\Command;
4+
5+
/**
6+
* Client is responsible for creating a ConcreteCommand and setting its a Receiver
7+
*/
8+
class Client
9+
{
10+
/**
11+
* Creates a ConcreteCommand object, sets its receiver and test invoker
12+
*/
13+
public function run()
14+
{
15+
$receiver = new Receiver();
16+
$helloCommand = new HelloCommand($receiver);
17+
18+
$invoker = new Invoker();
19+
$invoker->setCommand($helloCommand);
20+
$invoker->run();
21+
}
22+
}

0 commit comments

Comments
 (0)