本文整理汇总了PHP中Psy\Shell::setIncludes方法的典型用法代码示例。如果您正苦于以下问题:PHP Shell::setIncludes方法的具体用法?PHP Shell::setIncludes怎么用?PHP Shell::setIncludes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Psy\Shell
的用法示例。
在下文中一共展示了Shell::setIncludes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle the command.
*
* @return void
*/
public function handle()
{
$this->getApplication()->setCatchExceptions(false);
$shell = new Shell();
$shell->setIncludes($this->argument('include'));
$shell->run();
}
示例2: testIncludes
public function testIncludes()
{
$shell = new Shell();
$this->assertEmpty($shell->getIncludes());
$shell->setIncludes(array('foo', 'bar', 'baz'));
$this->assertEquals(array('foo', 'bar', 'baz'), $shell->getIncludes());
}
示例3: testIncludes
public function testIncludes()
{
$config = $this->getConfig(array('configFile' => __DIR__ . '/../../fixtures/empty.php'));
$shell = new Shell($config);
$this->assertEmpty($shell->getIncludes());
$shell->setIncludes(array('foo', 'bar', 'baz'));
$this->assertEquals(array('foo', 'bar', 'baz'), $shell->getIncludes());
}
示例4: actionIndex
/**
* Runs interactive shell
*/
public function actionIndex()
{
$config = new Configuration();
$config->getPresenter()->addCasters($this->getCasters());
$shell = new Shell($config);
$shell->setIncludes($this->include);
$shell->run();
}
示例5: fire
/**
* @return void
*/
public function fire()
{
$this->getApplication()->setCatchExceptions(false);
$config = new Configuration();
$config->getPresenter()->addCasters($this->getCasters());
$shell = new Shell($config);
$shell->addCommands($this->getCommands());
$shell->setIncludes($this->argument('include'));
$shell->run();
}
示例6: bin
/**
* `psysh` command line executable.
*
* @return Closure
*/
function bin()
{
return function () {
$usageException = null;
$input = new ArgvInput();
try {
$input->bind(new InputDefinition(array(new InputOption('help', 'h', InputOption::VALUE_NONE), new InputOption('config', 'c', InputOption::VALUE_REQUIRED), new InputOption('version', 'v', InputOption::VALUE_NONE), new InputOption('cwd', null, InputOption::VALUE_REQUIRED), new InputArgument('include', InputArgument::IS_ARRAY))));
} catch (\RuntimeException $e) {
$usageException = $e;
}
$config = array();
// Handle --config
if ($configFile = $input->getOption('config')) {
$config['configFile'] = $configFile;
}
$shell = new Shell(new Configuration($config));
// Handle --help
if ($usageException !== null || $input->getOption('help')) {
if ($usageException !== null) {
echo $usageException->getMessage() . PHP_EOL . PHP_EOL;
}
$version = $shell->getVersion();
$name = basename(reset($_SERVER['argv']));
echo <<<EOL
{$version}
Usage:
{$name} [--version] [--help] [files...]
Options:
--help -h Display this help message.
--config -c Use an alternate PsySH config file location.
--cwd Use an alternate working directory.
--version -v Display the PsySH version.
EOL;
exit($usageException === null ? 0 : 1);
}
// Handle --version
if ($input->getOption('version')) {
echo $shell->getVersion() . PHP_EOL;
exit(0);
}
// Pass additional arguments to Shell as 'includes'
$shell->setIncludes($input->getArgument('include'));
try {
// And go!
$shell->run();
} catch (Exception $e) {
echo $e->getMessage() . PHP_EOL;
// TODO: this triggers the "exited unexpectedly" logic in the
// ForkingLoop, so we can't exit(1) after starting the shell...
// fix this :)
// exit(1);
}
};
}
示例7: handle
/**
* @inheritDoc
*/
public function handle(InputInterface $input, OutputInterface $output)
{
$shell = new BaseShell();
$shell->setIncludes($input->getArgument('includes'));
$shell->run();
}