本文整理汇总了PHP中Illuminate\Console\Application类的典型用法代码示例。如果您正苦于以下问题:PHP Application类的具体用法?PHP Application怎么用?PHP Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Application类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getArtisan
/**
* Get the Artisan console instance.
*
* @return \Illuminate\Console\Application
*/
protected function getArtisan()
{
if (!is_null($this->artisan)) {
return $this->artisan;
}
$this->app->loadDeferredProviders();
$this->artisan = ConsoleApplication::make($this->app);
return $this->artisan->boot();
}
示例2: getWel
/**
* Get the Artisan console instance.
*
* @return \Illuminate\Console\Application
*/
protected function getWel()
{
if (!is_null($this->wel)) {
return $this->wel;
}
$this->app->loadDeferredProviders();
$this->wel = ConsoleApplication::make($this->app);
return $this->wel->boot();
}
示例3: array
function it_will_run_seeder_with_custom_class_if_told_to(Console $console)
{
$console->call('migrate:install')->shouldBeCalled();
$console->call('migrate:refresh')->shouldBeCalled();
$console->call('db:seed', array('--class' => 'MyDatabaseSeeder'))->shouldBeCalled();
$this->appInst->setRequestForConsoleEnvironment()->shouldBeCalled();
$this->appInst->boot()->shouldBeCalled();
$this->appInst->make('artisan')->shouldBeCalled();
$this->appInst->make('artisan')->willReturn($console);
$this->beConstructedWith(null, '.');
$this->setMigrateDatabase(true);
$this->setSeedDatabase(true, 'MyDatabaseSeeder');
$this->refreshApplication($this->appInst);
}
示例4: runCommand
/**
* Runs a command and returns it output
*
* @param \Symfony\Component\HttpKernel\Client $client
* @param $command
*
* @return string|\Symfony\Component\Console\Output\StreamOutput
*/
public function runCommand(Client $client, $command)
{
$application = new Application($client->getKernel());
$application->setAutoExit(false);
$fp = tmpfile();
$input = new StringInput($command);
$output = new StreamOutput($fp);
$application->run($input, $output);
fseek($fp, 0);
$output = '';
while (!feof($fp)) {
$output = fread($fp, 4096);
}
fclose($fp);
return $output;
}
示例5: command
/**
* Add a new Artisan command event to the schedule.
*
* @param string $command
* @param array $parameters
* @return \Illuminate\Console\Scheduling\Event
*/
public function command($command, array $parameters = [])
{
if (class_exists($command)) {
$command = Container::getInstance()->make($command)->getName();
}
return $this->exec(Application::formatCommandString($command), $parameters);
}
示例6: getArtisan
/**
* Get the Artisan console instance.
*
* @return Illuminate\Console\Application
*/
protected function getArtisan()
{
if (!is_null($this->artisan)) {
return $this->artisan;
}
return $this->artisan = ConsoleApplication::start($this->app);
}
示例7: __construct
public function __construct(Container $container)
{
parent::__construct('XenForo Developer Toolkit', '1.0-dev');
$this->setContainer($container);
$container['app'] = $this;
$container->alias('app', 'Robbo\\XfToolkit\\Application');
$container->bindShared('xenforo', function ($container) {
return new XenForo($this, new Filesystem());
});
$container->alias('xenforo', 'Robbo\\XfToolkit\\XenForo');
$this->registerBundledCommands();
}
示例8: __construct
/**
* Setup the application
*/
public function __construct()
{
parent::__construct('Satellite', '0.1.0');
// Setup application's dependencies
$app = new Container();
$provider = new SatelliteServiceProvider($app);
$provider->register();
// Register services
$this->laravel = $app;
// Add commands
$this->resolveCommands(array('Rocketeer\\Satellite\\Console\\Commands\\Setup', 'Rocketeer\\Satellite\\Console\\Commands\\ListApplications', 'Rocketeer\\Satellite\\Console\\Commands\\Deploy', 'Rocketeer\\Satellite\\Console\\Commands\\Update'));
}
示例9: run
public function run()
{
if (!$this->checkUser()) {
echo '<p>' . Lang::get('web-artisan::webartisan.terminal.needlogin') . '</p>';
return;
}
$parts = explode(" ", Input::get('cmd'));
if (count($parts) < 2) {
echo '<p>' . Lang::get('web-artisan::webartisan.terminal.invalidcmd') . '</p>';
return;
}
//first is "artisan" so remove it
unset($parts[0]);
//second is the command
$cmd = $parts[1];
unset($parts[1]);
$app = app();
$app->loadDeferredProviders();
$artisan = ConsoleApplication::start($app);
$command = $artisan->find($cmd);
$def = $command->getDefinition();
$arguments = $def->getArguments();
$fix = array();
foreach ($arguments as $argument) {
$fix[] = $argument->getName();
}
$arguments = $fix;
$params = array();
//the rest should be the parameter list
$i = 0;
//The counter for our argument list
foreach ($parts as $param) {
// foo=bar, we don't need to work more
if (strpos($param, "=") !== false) {
$param = explode("=", $param, 2);
$params[$param[0]] = $param[1];
} else {
//Do we have an argument or an option?
if (substr($param, 0, 1) == "-") {
$params[$param] = true;
//Option, simply set it to true
} else {
//Argument, we need a bit work
$params[$arguments[$i]] = $param;
++$i;
}
}
}
$params['command'] = $cmd;
$input = new ArrayInput($params);
$command->run($input, new Output());
}
示例10: __construct
/**
* Console constructor.
*
* @param ConfigInterface $config
* @param Paths $paths
* @param string $version
*/
public function __construct(ConfigInterface $config, Paths $paths, $version = \F9\Application\Application::VERSION)
{
$this->config = $config;
$this->paths = $paths;
/** @var Container $app */
$app = Forge::find('app');
// the parent is a hijacked copy of the illuminate console application.
// we hijacked it mainly to override a few properties - such as the title.
parent::__construct(forge('illuminate.container'), forge('illuminate.events'), $version);
//$this->bootSettings();
$this->configureEnvironment();
// in all cases, register the framework commands
$this->registerFrameworkCommands();
// register the cloned artisan commands
$this->registerArtisanCommands();
}
示例11: setDefaultCommand
/**
* Sets the default Command name.
*
* @param string $commandName The Command name
* @static
*/
public static function setDefaultCommand($commandName)
{
//Method inherited from \Symfony\Component\Console\Application
return \Illuminate\Console\Application::setDefaultCommand($commandName);
}
示例12: getDefaultInputDefinition
/**
* Get the default definition.
*
* @return \Symfony\Component\Console\Input\InputDefinition
*/
protected function getDefaultInputDefinition()
{
$definition = parent::getDefaultInputDefinition();
$definition->addOption($this->getApplicationReferenceOption());
return $definition;
}
示例13: __construct
public function __construct(Container $laravel, Dispatcher $events, $version, SymfonyApplication $application)
{
$this->application = $application;
parent::__construct($laravel, $events, $version);
}
示例14: getHelp
/**
* Display the application's help.
*
* @return string
*/
public function getHelp()
{
$help = str_replace($this->getLongVersion(), null, parent::getHelp());
$state = $this->buildBlock('Current state', $this->getCurrentState());
$help = sprintf('%s' . PHP_EOL . PHP_EOL . '%s%s', $this->getLongVersion(), $state, $help);
return $help;
}
示例15: getDefinition
/**
* Overridden so that the application doesn't expect the command
* name to be the first argument.
*/
public function getDefinition()
{
$inputDefinition = parent::getDefinition();
// clear out the normal first argument, which is the command name
$inputDefinition->setArguments();
return $inputDefinition;
}