mxmbsocket/lib/Ratchet/Command/Runtime.php
Chris Boden a6073a87eb Communication between versions
HyBi-10 and Hixie-76 can now talk to each other!
2011-11-01 15:19:03 -04:00

31 lines
696 B
PHP

<?php
namespace Ratchet\Command;
use Ratchet\SocketInterface;
class Runtime implements CommandInterface {
/**
* @var SocketInterface
*/
protected $_socket;
/**
* @var Closure
*/
protected $_command = null;
public function __construct(SocketInterface $socket) {
$this->_socket = $socket;
}
/**
* Your closure should accept a single \Ratchet\Socket parameter
* @param Closure Your closure/lambda to execute when the time comes
*/
public function setCommand(\Closure $callback) {
$this->_command = $callback;
}
public function execute() {
return call_user_func($this->_command, $socket);
}
}