mxmbsocket/lib/Ratchet/Command/Runtime.php
Chris Boden 3127efc981 Cleanup
Removed redundant Interfaces
Removed a number of unused methods
2011-11-01 09:52:41 -04:00

33 lines
763 B
PHP

<?php
namespace Ratchet\Command;
use Ratchet\SocketCollection;
class Runtime implements CommandInterface {
/**
* @var SocketCollection
*/
protected $_sockets;
/**
* @var Closure
*/
protected $_command = null;
public function __construct(SocketCollection $sockets) {
$this->_socket = $sockets;
}
/**
* 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() {
foreach ($this->_sockets as $socket) {
return call_user_func($this->_command, $socket);
}
}
}