当前位置: 首页>>代码示例>>PHP>>正文


PHP ArgvInput::getFirstArgument方法代码示例

本文整理汇总了PHP中Symfony\Component\Console\Input\ArgvInput::getFirstArgument方法的典型用法代码示例。如果您正苦于以下问题:PHP ArgvInput::getFirstArgument方法的具体用法?PHP ArgvInput::getFirstArgument怎么用?PHP ArgvInput::getFirstArgument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Console\Input\ArgvInput的用法示例。


在下文中一共展示了ArgvInput::getFirstArgument方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadCommands

 /**
  * @param OutputInterface $output
  */
 public function loadCommands(OutputInterface $output)
 {
     // $application is required to be defined in the register_command scripts
     $application = $this->application;
     require_once \OC::$SERVERROOT . '/core/register_command.php';
     if ($this->config->getSystemValue('installed', false)) {
         if (!\OCP\Util::needUpgrade()) {
             OC_App::loadApps();
             foreach (OC_App::getAllApps() as $app) {
                 $file = OC_App::getAppPath($app) . '/appinfo/register_command.php';
                 if (file_exists($file)) {
                     require $file;
                 }
             }
         } else {
             $output->writeln("ownCloud or one of the apps require upgrade - only a limited number of commands are available");
         }
     } else {
         $output->writeln("ownCloud is not installed - only a limited number of commands are available");
     }
     $input = new ArgvInput();
     if ($input->getFirstArgument() !== 'check') {
         $errors = \OC_Util::checkServer(\OC::$server->getConfig());
         if (!empty($errors)) {
             foreach ($errors as $error) {
                 $output->writeln($error['error']);
                 $output->writeln($error['hint']);
                 $output->writeln('');
             }
             throw new \Exception("Environment not properly prepared.");
         }
     }
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:36,代码来源:application.php

示例2: isSafe

 public function isSafe(ArgvInput $input, $env)
 {
     if ('prod' == $env) {
         if (in_array($input->getFirstArgument(), $this->productionBlackList)) {
             return false;
         }
     }
     return true;
 }
开发者ID:hotfics,项目名称:lichess-old,代码行数:9,代码来源:ConsoleGuardRail.php

示例3: handleCompilerEnvironment

 /**
  * Determine whether a CLI command is for compilation, and if so, clear the directory
  *
  * @throws \Magento\Framework\Exception\FileSystemException
  * @return void
  */
 public function handleCompilerEnvironment()
 {
     $compilationCommands = [DiCompileCommand::NAME, DiCompileMultiTenantCommand::NAME];
     $cmdName = $this->input->getFirstArgument();
     $isHelpOption = $this->input->hasParameterOption('--help') || $this->input->hasParameterOption('-h');
     if (!in_array($cmdName, $compilationCommands) || $isHelpOption) {
         return;
     }
     $generationDir = $cmdName === DiCompileMultiTenantCommand::NAME ? $this->input->getParameterOption(DiCompileMultiTenantCommand::INPUT_KEY_GENERATION) : null;
     if (!$generationDir) {
         $mageInitParams = $this->serviceManager->get(InitParamListener::BOOTSTRAP_PARAM);
         $mageDirs = isset($mageInitParams[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS]) ? $mageInitParams[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] : [];
         $generationDir = (new DirectoryList(BP, $mageDirs))->getPath(DirectoryList::GENERATION);
     }
     if ($this->filesystemDriver->isExists($generationDir)) {
         $this->filesystemDriver->deleteDirectory($generationDir);
     }
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:24,代码来源:CompilerPreparation.php

示例4: handleCompilerEnvironment

 /**
  * Determine whether a CLI command is for compilation, and if so, clear the directory
  *
  * @throws \Magento\Framework\Exception\FileSystemException
  * @return void
  */
 public function handleCompilerEnvironment()
 {
     $compilationCommands = [DiCompileCommand::NAME];
     $cmdName = $this->input->getFirstArgument();
     $isHelpOption = $this->input->hasParameterOption('--help') || $this->input->hasParameterOption('-h');
     if (!in_array($cmdName, $compilationCommands) || $isHelpOption) {
         return;
     }
     $compileDirList = [];
     $mageInitParams = $this->serviceManager->get(InitParamListener::BOOTSTRAP_PARAM);
     $mageDirs = isset($mageInitParams[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS]) ? $mageInitParams[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] : [];
     $directoryList = new DirectoryList(BP, $mageDirs);
     $compileDirList[] = $directoryList->getPath(DirectoryList::GENERATION);
     $compileDirList[] = $directoryList->getPath(DirectoryList::DI);
     foreach ($compileDirList as $compileDir) {
         if ($this->filesystemDriver->isExists($compileDir)) {
             $this->filesystemDriver->deleteDirectory($compileDir);
         }
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:26,代码来源:CompilerPreparation.php

示例5: onConsoleCommand

 /**
  * @param ConsoleCommandEvent $event
  */
 public function onConsoleCommand(ConsoleCommandEvent $event)
 {
     $command = $event->getCommand();
     /** @var Application $application */
     $application = $command->getApplication();
     $inputDefinition = $command->getDefinition();
     if ($command instanceof HelpCommand) {
         $input = new ArgvInput();
         $input->bind($inputDefinition);
         $command = $application->find($input->getFirstArgument());
     }
     if ($command instanceof BaseCommand) {
         $this->setInputDefinition($inputDefinition);
     }
 }
开发者ID:afrihost,项目名称:BaseCommandBundle,代码行数:18,代码来源:BaseOptionsEvent.php

示例6: loadCommands

 /**
  * @param OutputInterface $output
  * @throws \Exception
  */
 public function loadCommands(OutputInterface $output)
 {
     // $application is required to be defined in the register_command scripts
     $application = $this->application;
     require_once __DIR__ . '/../../../core/register_command.php';
     if ($this->config->getSystemValue('installed', false)) {
         if (\OCP\Util::needUpgrade()) {
             $output->writeln("ownCloud or one of the apps require upgrade - only a limited number of commands are available");
             $output->writeln("You may use your browser or the occ upgrade command to do the upgrade");
         } elseif ($this->config->getSystemValue('maintenance', false)) {
             $output->writeln("ownCloud is in maintenance mode - no app have been loaded");
         } else {
             OC_App::loadApps();
             foreach (\OC::$server->getAppManager()->getInstalledApps() as $app) {
                 $appPath = \OC_App::getAppPath($app);
                 if ($appPath === false) {
                     continue;
                 }
                 \OC::$loader->addValidRoot($appPath);
                 $file = $appPath . '/appinfo/register_command.php';
                 if (file_exists($file)) {
                     require $file;
                 }
             }
         }
     } else {
         $output->writeln("ownCloud is not installed - only a limited number of commands are available");
     }
     $input = new ArgvInput();
     if ($input->getFirstArgument() !== 'check') {
         $errors = \OC_Util::checkServer(\OC::$server->getConfig());
         if (!empty($errors)) {
             foreach ($errors as $error) {
                 $output->writeln((string) $error['error']);
                 $output->writeln((string) $error['hint']);
                 $output->writeln('');
             }
             throw new \Exception("Environment not properly prepared.");
         }
     }
 }
开发者ID:kenwi,项目名称:core,代码行数:45,代码来源:application.php

示例7: testGetFirstArgument

 public function testGetFirstArgument()
 {
     $input = new ArgvInput(array('cli.php', '-fbbar'));
     $this->assertEquals('', $input->getFirstArgument(), '->getFirstArgument() returns the first argument from the raw input');
     $input = new ArgvInput(array('cli.php', '-fbbar', 'foo'));
     $this->assertEquals('foo', $input->getFirstArgument(), '->getFirstArgument() returns the first argument from the raw input');
 }
开发者ID:ronaldlunaramos,项目名称:webstore,代码行数:7,代码来源:ArgvInputTest.php

示例8: loadCommands

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @throws \Exception
  */
 public function loadCommands(InputInterface $input, OutputInterface $output)
 {
     // $application is required to be defined in the register_command scripts
     $application = $this->application;
     $inputDefinition = $application->getDefinition();
     $inputDefinition->addOption(new InputOption('no-warnings', null, InputOption::VALUE_NONE, 'Skip global warnings, show command output only', null));
     try {
         $input->bind($inputDefinition);
     } catch (\RuntimeException $e) {
         //expected if there are extra options
     }
     if ($input->getOption('no-warnings')) {
         $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
     }
     require_once __DIR__ . '/../../../core/register_command.php';
     if ($this->config->getSystemValue('installed', false)) {
         if (\OCP\Util::needUpgrade()) {
             $output->writeln("ownCloud or one of the apps require upgrade - only a limited number of commands are available");
             $output->writeln("You may use your browser or the occ upgrade command to do the upgrade");
         } elseif ($this->config->getSystemValue('maintenance', false)) {
             $output->writeln("ownCloud is in maintenance mode - no app have been loaded");
         } else {
             OC_App::loadApps();
             foreach (\OC::$server->getAppManager()->getInstalledApps() as $app) {
                 $appPath = \OC_App::getAppPath($app);
                 if ($appPath === false) {
                     continue;
                 }
                 \OC::$loader->addValidRoot($appPath);
                 $file = $appPath . '/appinfo/register_command.php';
                 if (file_exists($file)) {
                     require $file;
                 }
             }
         }
     } else {
         $output->writeln("ownCloud is not installed - only a limited number of commands are available");
     }
     $input = new ArgvInput();
     if ($input->getFirstArgument() !== 'check') {
         $errors = \OC_Util::checkServer(\OC::$server->getConfig());
         if (!empty($errors)) {
             foreach ($errors as $error) {
                 $output->writeln((string) $error['error']);
                 $output->writeln((string) $error['hint']);
                 $output->writeln('');
             }
             throw new \Exception("Environment not properly prepared.");
         }
     }
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:56,代码来源:Application.php

示例9: boot

 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->publishes([__DIR__ . '/../config/propel.php' => config_path('propel.php')]);
     if (!$this->app->config['propel.propel.runtime.connections']) {
         throw new \InvalidArgumentException('Unable to guess Propel runtime config file. Please, initialize the "propel.runtime" parameter.');
     }
     // load pregenerated config
     if (file_exists(app_path() . '/propel/config.php')) {
         Propel::init(app_path() . '/propel/config.php');
         return;
     }
     // runtime configuration
     /** @var \Propel\Runtime\ServiceContainer\StandardServiceContainer */
     $serviceContainer = \Propel\Runtime\Propel::getServiceContainer();
     $serviceContainer->closeConnections();
     $serviceContainer->checkVersion('2.0.0-dev');
     $propel_conf = $this->app->config['propel.propel'];
     $runtime_conf = $propel_conf['runtime'];
     // set connections
     foreach ($runtime_conf['connections'] as $connection_name) {
         $config = $propel_conf['database']['connections'][$connection_name];
         if (!isset($config['classname'])) {
             if ($this->app->config['app.debug']) {
                 $config['classname'] = '\\Propel\\Runtime\\Connection\\DebugPDO';
             } else {
                 $config['classname'] = '\\Propel\\Runtime\\Connection\\ConnectionWrapper';
             }
         }
         $serviceContainer->setAdapterClass($connection_name, $config['adapter']);
         $manager = new \Propel\Runtime\Connection\ConnectionManagerSingle();
         $manager->setConfiguration($config + [$propel_conf['paths']]);
         $manager->setName($connection_name);
         $serviceContainer->setConnectionManager($connection_name, $manager);
     }
     $serviceContainer->setDefaultDatasource($runtime_conf['defaultConnection']);
     // set loggers
     $has_default_logger = false;
     if (isset($runtime_conf['log'])) {
         foreach ($runtime_conf['log'] as $logger_name => $logger_conf) {
             $serviceContainer->setLoggerConfiguration($logger_name, $logger_conf);
             $has_default_logger |= $logger_name === 'defaultLogger';
         }
     }
     if (!$has_default_logger) {
         $serviceContainer->setLogger('defaultLogger', \Log::getMonolog());
     }
     Propel::setServiceContainer($serviceContainer);
     $command = false;
     if (\App::runningInConsole()) {
         $input = new ArgvInput();
         $command = $input->getFirstArgument();
     }
     // skip auth driver adding if running as CLI to avoid auth model not found
     if ('propel:model:build' !== $command && 'propel' === \Config::get('auth.driver')) {
         $query_name = \Config::get('auth.user_query', false);
         if ($query_name) {
             $query = new $query_name();
             if (!$query instanceof Criteria) {
                 throw new InvalidConfigurationException("Configuration directive «auth.user_query» must contain valid classpath of user Query. Excpected type: instanceof Propel\\Runtime\\ActiveQuery\\Criteria");
             }
         } else {
             $user_class = \Config::get('auth.model');
             $query = new $user_class();
             if (!method_exists($query, 'buildCriteria')) {
                 throw new InvalidConfigurationException("Configuration directive «auth.model» must contain valid classpath of model, which has method «buildCriteria()»");
             }
             $query = $query->buildPkeyCriteria();
             $query->clear();
         }
         \Auth::extend('propel', function (\Illuminate\Foundation\Application $app) use($query) {
             return new PropelUserProvider($query, $app->make('hash'));
         });
     }
 }
开发者ID:Andrewwojownik,项目名称:propel-laravel,代码行数:79,代码来源:RuntimeServiceProvider.php

示例10: registerPropelAuth

 /**
  * Register propel auth provider.
  *
  * @return void
  */
 protected function registerPropelAuth()
 {
     $command = false;
     if (\App::runningInConsole()) {
         $input = new ArgvInput();
         $command = $input->getFirstArgument();
     }
     // skip auth driver adding if running as CLI to avoid auth model not found
     if ('propel:model:build' === $command) {
         return;
     }
     $query_name = \Config::get('auth.user_query', false);
     if ($query_name) {
         $query = new $query_name();
         if (!$query instanceof Criteria) {
             throw new InvalidConfigurationException("Configuration directive «auth.user_query» must contain valid classpath of user Query. Excpected type: instanceof Propel\\Runtime\\ActiveQuery\\Criteria");
         }
     } else {
         $user_class = \Config::get('auth.model');
         $query = new $user_class();
         if (!method_exists($query, 'buildCriteria')) {
             throw new InvalidConfigurationException("Configuration directive «auth.model» must contain valid classpath of model, which has method «buildCriteria()»");
         }
         $query = $query->buildPkeyCriteria();
         $query->clear();
     }
     \Auth::extend('propel', function (Application $app) use($query) {
         return new Auth\PropelUserProvider($query, $app->make('hash'));
     });
 }
开发者ID:julienvincent,项目名称:PropelLaravel,代码行数:35,代码来源:RuntimeServiceProvider.php


注:本文中的Symfony\Component\Console\Input\ArgvInput::getFirstArgument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。