public function __construct($path, $args = NULL)
{
$this->path = Helpers::escapeArg($path);
$proc = proc_open("{$this->path} -n {$args} -v", array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w')), $pipes, NULL, NULL, array('bypass_shell' => TRUE));
$output = stream_get_contents($pipes[1]);
$this->error = trim(stream_get_contents($pipes[2]));
if (proc_close($proc)) {
throw new \Exception("Unable to run '{$path}': " . preg_replace('#[\\r\\n ]+#', ' ', $this->error));
} elseif (!preg_match('#^PHP (\\S+).*c(g|l)i#i', $output, $matches)) {
throw new \Exception("Unable to detect PHP version (output: {$output}).");
}
$this->version = $matches[1];
$this->cgi = strcasecmp($matches[2], 'g') === 0;
$this->arguments = $args;
$job = new Job(__DIR__ . '/info.php', $this, array('xdebug'));
$job->run();
$this->xdebug = !$job->getExitCode();
}