public function __construct($host = '127.0.0.1', $docroot = null, $router = null, $php = PHP_BINARY) { $port = mt_rand(49152, 65535); $command = implode(' ', array_filter([escapeshellarg($php), '-S', escapeshellarg("{$host}:{$port}"), $docroot !== null ? '-t ' . escapeshellarg($docroot) : null, $router !== null ? escapeshellarg($router) : null], 'is_string')); parent::__construct($command, null, null, ['bypass_shell' => true]); $this->host = $host; $this->port = $port; }
public function __construct($name, $cmd, $wait, $signalOnError) { parent::__construct($cmd); $this->name = $name; $this->wait = $wait; $this->signalOnError = $signalOnError; // Register callback to be called when process terminates $this->on(self::EVENT_EXIT, array($this, 'onExit')); $this->on(self::EVENT_TERMINATED, array($this, 'onTerminated')); }