public function execute(Context $context) { while (true) { $current_command = $context->getCurrentCommand(); if (is_null($current_command)) { throw new RuntimeException('"end" not found '); } elseif ($current_command === 'end') { break; } else { $command = new CommandCommand(); $command->execute($context); } $context->next(); } }
private function hasSttyAvailable() { if (null !== self::$stty) { return self::$stty; } exec('stty 2>&1', $output, $exitcode); return self::$stty = $exitcode === 0; }