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


PHP ArgvInput::hasParameterOption方法代码示例

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


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

示例1: setupMode

 /**
  * @param Nette\Configurator $configurator
  * @return bool has the debug mode been modified?
  */
 public static function setupMode(Nette\Configurator $configurator)
 {
     if (PHP_SAPI !== 'cli') {
         return FALSE;
     }
     $input = new ArgvInput();
     if (!$input->hasParameterOption('--debug-mode')) {
         return FALSE;
     }
     if ($input->hasParameterOption(['--debug-mode=no', '--debug-mode=off', '--debug-mode=false', '--debug-mode=0'])) {
         $configurator->setDebugMode(FALSE);
         return TRUE;
     } else {
         $configurator->setDebugMode(TRUE);
         return TRUE;
     }
 }
开发者ID:kdyby,项目名称:console,代码行数:21,代码来源:BootstrapHelper.php

示例2: 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

示例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];
     $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

示例4: runCLI

 public static function runCLI($environment = 'dev', $debug = true)
 {
     set_time_limit(0);
     $input = new ArgvInput();
     $environment = $input->getParameterOption(array('--env', '-e'), $environment);
     $debug = !$input->hasParameterOption(array('--no-debug', '')) && $environment !== 'prod';
     if ($debug) {
         Debug::enable();
     }
     $kernel = new static($environment, $debug);
     $application = new Application($kernel);
     $application->run($input);
 }
开发者ID:morki,项目名称:bounce-bundle,代码行数:13,代码来源:Kernel.php

示例5: console

 /**
  * Runs Symfony2 in console mode.
  *
  * @param string $kernelClass Class name for the kernel to be ran.
  */
 public static function console($kernelClass)
 {
     set_time_limit(0);
     $input = new ArgvInput();
     // decide env and debug info based on cli params
     $env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
     $debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';
     if ($debug) {
         Debug::enable();
     }
     $kernel = new $kernelClass($env, $debug);
     $application = new Application($kernel);
     $application->run($input);
 }
开发者ID:michaldudek,项目名称:flavour,代码行数:19,代码来源:Run.php

示例6: getBundles

 /**
  * @return string[]
  * @author Maximilian Ruta <mr@xtain.net>
  */
 public function getBundles()
 {
     require_once $this->console->getAppDir() . '/AppKernel.php';
     $input = new ArgvInput();
     $env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev');
     $debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod';
     $kernel = new \AppKernel($env, $debug);
     $bundles = $kernel->registerBundles();
     $bundleMap = [];
     foreach ($bundles as $bundle) {
         $reflector = new \ReflectionClass($bundle);
         $bundlePath = dirname($reflector->getFileName());
         $bundleMap[$bundle->getName()] = $bundlePath;
     }
     return $bundleMap;
 }
开发者ID:XTAIN,项目名称:symfony-composer-util,代码行数:20,代码来源:Kernel.php

示例7: checkForSpecificEnvironmentFile

 /**
  * Detect if a custom environment file matching the APP_ENV exists.
  *
  * @param \Illuminate\Contracts\Foundation\Application|\Notadd\Foundation\Application $app
  *
  * @return void
  */
 protected function checkForSpecificEnvironmentFile($app)
 {
     if (php_sapi_name() == 'cli') {
         $input = new ArgvInput();
         if ($input->hasParameterOption('--env')) {
             $file = $app->environmentFile() . '.' . $input->getParameterOption('--env');
             $this->loadEnvironmentFile($app, $file);
         }
     }
     if (!env('APP_ENV')) {
         return;
     }
     if (empty($file)) {
         $file = $app->environmentFile() . '.' . env('APP_ENV');
         $this->loadEnvironmentFile($app, $file);
     }
 }
开发者ID:notadd,项目名称:framework,代码行数:24,代码来源:DetectEnvironment.php

示例8: install

 public static function install()
 {
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         return;
     }
     $input = new ArgvInput();
     if ($input->hasParameterOption(array('--no-interaction', '-n'))) {
         return;
     }
     $cwd = getcwd();
     $www = dirname($cwd);
     $site = basename($cwd);
     $arguments = array('site:install', 'site' => $site, '--www' => $www, '--interactive' => true, '--mysql_db_prefix' => '');
     self::logo();
     $output = new ConsoleOutput();
     $output->writeln("<info>Welcome to the Joomla Platform installer!</info>");
     $output->writeln("Fill in the following details to configure your new application.");
     $application = new Application();
     $application->run(new ArrayInput($arguments));
 }
开发者ID:allanpilarca,项目名称:joomla-platform,代码行数:20,代码来源:Project.php

示例9: install

 public static function install()
 {
     $output = new ConsoleOutput();
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         $output->writeln("<info>Sorry, automated installation is not yet supported on Windows!</info>");
         $output->writeln("Please refer to the documentation for alternative installation methods: http://developer.joomlatools.com/platform/getting-started.html");
         return;
     }
     $input = new ArgvInput();
     if ($input->hasParameterOption(array('--no-interaction', '-n'))) {
         return;
     }
     $cwd = getcwd();
     $www = dirname($cwd);
     $site = basename($cwd);
     $arguments = array('site:install', 'site' => $site, '--www' => $www, '--interactive' => true, '--mysql_db_prefix' => '');
     $output->writeln("<info>Welcome to the Joomlatools Platform installer!</info>");
     $output->writeln("Fill in the following details to configure your new application.");
     $application = new Application();
     $application->run(new ArrayInput($arguments));
 }
开发者ID:woakes070048,项目名称:joomlatools-platform,代码行数:21,代码来源:Project.php

示例10: ArgvInput

 /**
  * Handles the brood default options/arguments.
  */
 public static final function ArgvInput()
 {
     # get the raw commands
     $raws = ['--env', '--timeout'];
     # get the options from Brood
     $options = [Brood::environmentOption(), Brood::timeoutOption()];
     $instances = [];
     $reflect = new ReflectionClass(InputOption::class);
     foreach ($options as $opt) {
         $instances[] = $reflect->newInstanceArgs($opt);
     }
     # still, listen to the php $_SERVER['argv']
     $cmd_input = new ArgvInput();
     # get the default brood options
     $brood_input = new ArgvInput($raws, new InputDefinition($instances));
     foreach ($raws as $raw) {
         if ($cmd_input->hasParameterOption([$raw])) {
             $val = $cmd_input->getParameterOption($raw);
             $val = is_numeric($val) ? (int) $val : $val;
             $brood_input->setOption(str_replace('-', '', $raw), $val);
         }
     }
     return $brood_input;
 }
开发者ID:phalconslayer,项目名称:framework,代码行数:27,代码来源:CLI.php

示例11: ArgvInput

<?php

/**
 * Project: zaralab
 * Filename: console.php
 *
 * @author Miroslav Yovchev <m.yovchev@corllete.com>
 * @since 31.10.15
 */
require __DIR__ . '/../vendor/autoload.php';
use Symfony\Component\Console\Input\ArgvInput;
use Zaralab\Framework\Console\App;
use Zaralab\Framework\Config;
// Override DEBUG/ENV
$input = new ArgvInput();
$env = $input->getParameterOption(array('--env', '-e'), null);
$debug = $env === null ? null : !$input->hasParameterOption(array('--no-debug', '')) && $env != 'prod';
$container = Config::containerFactory(__DIR__, $env, $debug);
// Set current directory to application root so we can find root config files
chdir(__DIR__ . '/..');
$app = new App($container);
$app->setCatchExceptions(true);
// Set up DIC
require __DIR__ . '/dependencies.php';
$app->run($input);
开发者ID:myovchev,项目名称:zaralab-api,代码行数:25,代码来源:console.php

示例12: testHasParameterOptionOnlyOptions

 public function testHasParameterOptionOnlyOptions()
 {
     $input = new ArgvInput(array('cli.php', '-f', 'foo'));
     $this->assertTrue($input->hasParameterOption('-f', true), '->hasParameterOption() returns true if the given short option is in the raw input');
     $input = new ArgvInput(array('cli.php', '--foo', '--', 'foo'));
     $this->assertTrue($input->hasParameterOption('--foo', true), '->hasParameterOption() returns true if the given long option is in the raw input');
     $input = new ArgvInput(array('cli.php', '--foo=bar', 'foo'));
     $this->assertTrue($input->hasParameterOption('--foo', true), '->hasParameterOption() returns true if the given long option with provided value is in the raw input');
     $input = new ArgvInput(array('cli.php', '--', '--foo'));
     $this->assertFalse($input->hasParameterOption('--foo', true), '->hasParameterOption() returns false if the given option is in the raw input but after an end of options signal');
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:11,代码来源:ArgvInputTest.php

示例13: substr

$phpbb_root_path = __DIR__ . '/../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require $phpbb_root_path . 'includes/startup.' . $phpEx;
require $phpbb_root_path . 'phpbb/class_loader.' . $phpEx;
$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
$phpbb_class_loader->register();
$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx);
extract($phpbb_config_php_file->get_all());
require $phpbb_root_path . 'includes/constants.' . $phpEx;
require $phpbb_root_path . 'includes/functions.' . $phpEx;
require $phpbb_root_path . 'includes/functions_admin.' . $phpEx;
require $phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx;
$phpbb_container_builder = new \phpbb\di\container_builder($phpbb_config_php_file, $phpbb_root_path, $phpEx);
$phpbb_container_builder->set_dump_container(false);
$input = new ArgvInput();
if ($input->hasParameterOption(array('--safe-mode'))) {
    $phpbb_container_builder->set_use_extensions(false);
    $phpbb_container_builder->set_dump_container(false);
} else {
    $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
    $phpbb_class_loader_ext->register();
    phpbb_load_extensions_autoloaders($phpbb_root_path);
}
$phpbb_container = $phpbb_container_builder->get_container();
$phpbb_container->get('request')->enable_super_globals();
require $phpbb_root_path . 'includes/compatibility_globals.' . $phpEx;
$user = $phpbb_container->get('user');
$user->data['user_id'] = ANONYMOUS;
$user->ip = '127.0.0.1';
$user->add_lang('acp/common');
$user->add_lang('cli');
开发者ID:WarriorMachines,项目名称:warriormachines-phpbb,代码行数:31,代码来源:phpbbcli.php

示例14: array

 * If not, see http://www.gnu.org/licenses/.
 */
$values = array();
if (defined("PHAR")) {
    require_once "phar://kengrabber.phar/vendor/autoload.php";
    $values['app_root'] = dirname(Phar::running(false));
    $values['root'] = dirname(__DIR__);
} else {
    require_once "vendor/autoload.php";
    $values['app_root'] = $values['root'] = dirname(__DIR__);
}
use rootLogin\Kengrabber\Kengrabber;
use Symfony\Component\Console\Input\ArgvInput;
$input = new ArgvInput();
$env = $input->getParameterOption(array('--env', '-e'), getenv('APP_ENV') ?: 'dev');
$debug = $input->hasParameterOption(array('--debug'));
//Remove the options
$bad = ['--env', '-e', '--debug'];
foreach ($_SERVER['argv'] as $key => $value) {
    if (in_array($value, $bad)) {
        unset($_SERVER['argv'][$key]);
    }
}
// enable all errors with debug == true
if ($debug) {
    error_reporting(E_ALL);
}
$values['debug'] = isset($debug) ? $debug : false;
$values['env'] = isset($env) ? $env : 'prod';
$app = new Kengrabber($values);
$app->run();
开发者ID:engelju,项目名称:kexpgrabber,代码行数:31,代码来源:bootstrap.php

示例15: ArgvInput

date_default_timezone_set('UTC');
// Include Composer autoload
require_once __DIR__ . '/../vendor/autoload.php';
// Get config
$aConfig = call_user_func(function () {
    $aGlobalConfig = (require __DIR__ . '/../app/config/global.php');
    $aLocalConfig = file_exists(__DIR__ . '/../app/config/local.php') ? require __DIR__ . '/../app/config/local.php' : [];
    return ExtendedArray::extendWithDefaultValues($aLocalConfig, $aGlobalConfig);
});
// Get inputs
$oInput = new ArgvInput();
// Build logger
/** @var \Psr\Log\LoggerInterface $oLogger */
$oLogger = call_user_func(function () use($aConfig, $oInput) {
    // Get min level message
    if ($oInput->hasParameterOption(['-v', '-vv', '-vvv', '--verbose'])) {
        $iMinMsgLevel = LogLevel::DEBUG;
    } else {
        $iMinMsgLevel = LogLevel::INFO;
    }
    // Build handlers
    $oHandler = new StreamHandler('php://stdout', $iMinMsgLevel);
    $oSyslogHandler = new SyslogHandler($aConfig['logger']['syslog']['ident'], $aConfig['logger']['syslog']['facility'], $aConfig['logger']['syslog']['level']);
    // Set formatter
    $oLineFormatter = new LineFormatter($aConfig['logger']['line_format'], $aConfig['logger']['date_format'], false, true);
    $oHandler->setFormatter($oLineFormatter);
    // Build logger
    return new Logger($aConfig['logger']['name'], [$oHandler, $oSyslogHandler]);
});
// Build Connection Locator
/* @var $oDbConnectionLocator \Aura\Sql\ConnectionLocator */
开发者ID:asticode,项目名称:php-deployment-manager,代码行数:31,代码来源:bootstrap.php


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