本文整理匯總了PHP中Shell::isEOF方法的典型用法代碼示例。如果您正苦於以下問題:PHP Shell::isEOF方法的具體用法?PHP Shell::isEOF怎麽用?PHP Shell::isEOF使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Shell
的用法示例。
在下文中一共展示了Shell::isEOF方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doShell
/**
* Handle the run shell action
* @return ShellResult
*/
public function doShell()
{
// $shell is derived from RunResult
$shell = new Shell();
while (!$shell->isEOF()) {
if ($shell->isFail()) {
break;
}
$input = $shell->readInput();
if ($input === FALSE) {
break;
}
// Available shell commands (for help sreen)
$shell_commands = array('dump', 'exit', 'help');
// Interpret shell keywords
switch ($input) {
case 'exit':
break 2;
case 'dump':
$this->stdout(print_r($this->getMemory()->getData(), true));
break;
case 'help':
$extension_manager = $this->getExtensionManager();
$exports = $extension_manager->exports();
$this->stdout(PHP_EOL);
$this->stdout(str_pad(' Commands:', 13) . join(', ', $shell_commands) . PHP_EOL);
$this->stdout(str_pad(' Keywords:', 13) . join(', ', $this->getLanguageKeywords()) . PHP_EOL);
$this->stdout(str_pad(' Functions:', 13) . join(', ', $exports) . PHP_EOL);
$this->stdout(PHP_EOL);
break;
default:
// Assume is code
$this->setCode($input);
$result = $this->doRun();
// TODO: Finished this
// dd($result);
// $this->stdout()
// Handle printing errors
if ($result->isFail()) {
foreach ($result->getErrors() as $error) {
$this->stderr($this->outputFormatErrorMessage($error));
}
}
break;
}
// TODO: Provide interface for setting position :/
$this->line++;
$this->column = 0;
}
$shell->setData($this->getMemory()->getData());
return $shell;
}