mxmbsocket/lib/Ratchet/Command/Action/Runtime.php
Chris Boden 15ec375405 Closure
onClose hook is triggered upon is CloseConnection command (server side) now.  Allowing applications to handle any final executions before the connection is closed.
Updated some API documentation.
2011-11-08 11:04:30 -05:00

23 lines
691 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 two parameters (\Ratchet\SocketInterface, \Ratchet\SocketObserver) 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(), $scope);
}
}