Паттерн "Команда"

Run Settings
LanguagePHP
Language Version
Run Command
<?php interface ICommand { function execute(); } interface IActor { function doAction(); } class SomeShit implements IActor { function __construct() { echo('SomeShit initiated!'); } public function doAction() { echo('SomeShit do some shit!'); } } class ShitCommand implements ICommand { public $_actor; function __construct() { $this->_actor = new SomeShit(); } public function execute() { $this->_actor->doAction(); } } class Commander { private $commands = array(); function __construct() { $this->commands[]=new ShitCommand(); } function doAll() { foreach($this->commands as $command) { $command->execute(); } } } $c = new Commander(); $c->doAll();
Editor Settings
Theme
Key bindings
Full width
Lines