mxmbsocket/lib/Ratchet/Command/Action/Runtime.php
Chris Boden 1d14119bb5 Command Refactoring
Refactored Command namespace; reusing more code, standardized interfaces
WebSocket handles wrapping messages better/properly now
2011-11-08 09:32:20 -05:00

23 lines
650 B
PHP

<?php
namespace Ratchet\Command\Action;
use Ratchet\Command\ActionTemplate;
use Ratchet\SocketObserver;
class Runtime extends ActionTemplate {
/**
* @var Closure
*/
protected $_command = null;
/**
* Your closure should accept a single \Ratchet\SocketInterface parameter and return a CommandInterface or NULL
* @param Closure Your closure/lambda to execute when the time comes
*/
public function setCommand(\Closure $callback) {
$this->_command = $callback;
}
public function execute(SocketObserver $scope = null) {
return call_user_func($this->_command, $this->getSocket());
}
}