Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class RemoteController
- {
- private $onOffCommand;
- private $nextChannelCommand;
- private $previousChannelCommand;
- private $volumeUpCommand;
- private $volumeDownCommand;
- public function __construct(TV $tv)
- {
- $this->onOffCommand = new OnOffCommand($tv);
- $this->nextChannelCommand = new NextChannelCommand($tv);
- $this->previousChannelCommand = new PreviousChannelCommand($tv);
- $this->volumeUpCommand = new VolumeUpCommand($tv);
- $this->volumeDownCommand = new VolumeDownCommand($tv);
- }
- public function onOffButton()
- {
- $this->onOffCommand->execute();
- }
- public function nextChannelButton()
- {
- $this->nextChannelCommand->execute();
- }
- public function previousChannelButton()
- {
- $this->previousChannelCommand->execute();
- }
- public function volumeUpButton()
- {
- $this->volumeUpCommand->execute();
- }
- public function volumeDownButton()
- {
- $this->volumeDownCommand->execute();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement