Added context to App facade constructor

This commit is contained in:
Melnikov Alexandr 2017-10-20 11:21:18 +06:00 committed by Chris Boden
parent 08480d1811
commit 409139fabd

View File

@ -61,8 +61,9 @@ class App {
* @param int $port Port to listen on. If 80, assuming production, Flash on 843 otherwise expecting Flash to be proxied through 8843
* @param string $address IP address to bind to. Default is localhost/proxy only. '0.0.0.0' for any machine.
* @param LoopInterface $loop Specific React\EventLoop to bind the application to. null will create one for you.
* @param array $context
*/
public function __construct($httpHost = 'localhost', $port = 8080, $address = '127.0.0.1', LoopInterface $loop = null) {
public function __construct($httpHost = 'localhost', $port = 8080, $address = '127.0.0.1', LoopInterface $loop = null, $context = array()) {
if (extension_loaded('xdebug') && getenv('RATCHET_DISABLE_XDEBUG_WARN') === false) {
trigger_error('XDebug extension detected. Remember to disable this if performance testing or going live!', E_USER_WARNING);
}
@ -74,7 +75,7 @@ class App {
$this->httpHost = $httpHost;
$this->port = $port;
$socket = new Reactor($address . ':' . $port, $loop);
$socket = new Reactor($address . ':' . $port, $loop, $context);
$this->routes = new RouteCollection;
$this->_server = new IoServer(new HttpServer(new Router(new UrlMatcher($this->routes, new RequestContext))), $socket, $loop);