protected function loop()
{
$php = new php();
$php->addOption('-f', $_SERVER['argv'][0])->addArgument('--disable-loop-mode');
if ($this->cli->isTerminal() === true) {
$php->addArgument('--force-terminal');
}
$addScoreFile = false;
foreach ($this->argumentsParser->getValues() as $argument => $values) {
switch ($argument) {
case '-l':
case '--loop':
case '--disable-loop-mode':
break;
case '-sf':
case '--score-file':
$addScoreFile = true;
break;
default:
if ($this->argumentsParser->argumentHasHandler($argument) === false) {
$min = null;
$closestArgument = $this->argumentsParser->getClosestArgument($argument, $min);
if ($closestArgument !== null && $min === 0) {
$php->addArgument($closestArgument, join(' ', $values));
} else {
$php->addArgument('-f', $argument);
}
} else {
$php->addArgument($argument, join(' ', $values));
}
}
}
if ($this->scoreFile === null) {
$this->scoreFile = sys_get_temp_dir() . '/atoum.score';
@unlink($this->scoreFile);
$addScoreFile = true;
}
if ($addScoreFile === true) {
$php->addArgument('--score-file', $this->scoreFile);
}
while ($this->canRun() === true) {
passthru((string) $php);
if ($this->loop === false || $this->looper->runAgain() === false) {
$this->stopRun();
}
}
return $this;
}