本文整理汇总了PHP中Symfony\Component\Console\Input\ArgvInput::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP ArgvInput::__construct方法的具体用法?PHP ArgvInput::__construct怎么用?PHP ArgvInput::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Input\ArgvInput
的用法示例。
在下文中一共展示了ArgvInput::__construct方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$argv = $_SERVER['argv'];
// auto insert a blank command name
array_splice($argv, 1, 0, '');
parent::__construct($argv);
}
示例2: __construct
public function __construct(array $argv = null)
{
if (null === $argv) {
$argv = $_SERVER['argv'];
}
$argv = $this->extractRawArgs($argv);
parent::__construct($argv);
}
示例3: __construct
/**
* Constructor.
*
* @param array $argv An array of parameters from the CLI (in the argv format)
*/
public function __construct(array $argv = null)
{
parent::__construct($argv, null);
// Strip the first argument if it is a directory because it will then be the pyrus directory
if (isset($this->tokens[0]) && @is_dir($this->tokens[0])) {
$this->registryPath = $this->tokens[0];
array_shift($this->tokens);
}
}
示例4: __construct
/**
* Constructor.
*
* The constructor has been overridden to check whether the first element in
* the argument list is an argument (as it represents the command name).
*
* If it is not then we insert the command name: *project:run*.
*
* This way we can ensure that if no command name is given that the project
* defaults to the execution of phpDocumentor. This is behavior that is
* expected from previous releases of phpDocumentor.
*
* @param string[] $argv An array of parameters from the CLI (in the argv format)
* @param InputDefinition $definition A InputDefinition instance
*
* @api
*/
public function __construct(array $argv = null, InputDefinition $definition = null)
{
if (null === $argv) {
$argv = $_SERVER['argv'];
}
if (count($argv) === 1 || $argv[1][0] === '-') {
array_splice($argv, 1, 0, 'project:run');
}
parent::__construct($argv, $definition);
}
示例5: __construct
/**
* Constructor
*
* @param Request $request
* @param InputDefinition $definition
*/
public function __construct(Request $request, InputDefinition $definition = null)
{
$parameters = array(null);
foreach ($request->getParams() as $key => $param) {
if (is_numeric($key)) {
$parameters[] = $param;
}
}
parent::__construct($parameters, $definition);
}
示例6: __construct
/**
* Constructor.
*
* @since 1.0.0
*
* @access public
* @global array $argv Global array of console arguments passed to script.
* @param array $args An array of parameters from the CLI (in the argv format).
* @param \Symfony\Component\Console\Input\InputDefinition $definition Input definition instance.
*/
public function __construct(array $args = null, InputDefinition $definition = null)
{
global $argv;
if (is_null($args)) {
$args = array_slice((array) $argv, 1);
$args = array_filter($args, array($this, 'filter_arguments'));
$args = array_values($args);
}
parent::__construct($args, $definition);
}
示例7: __construct
/**
* Constructor.
*
* @param array $argv An array of parameters from the CLI (in the argv format)
* @param InputDefinition $definition A InputDefinition instance
*/
public function __construct(array $argv = null, InputDefinition $definition = null)
{
if (null === $argv) {
$argv = $_SERVER['argv'];
}
$this->argv = $argv;
// strip the application name
array_shift($this->argv);
parent::__construct($argv, $definition);
}
示例8: __construct
/**
* Construct a new bound argv input.
*
* @param array<integer,string> $boundArguments The bound arguments.
* @param array<integer,string>|null $argv The argv values.
* @param InputDefinition|null $definition The input definition.
*
* @throws Exception\UndefinedArgvException If argv information cannot be determined.
*/
public function __construct(array $boundArguments, array $argv = null, InputDefinition $definition = null)
{
if (null === $argv) {
if (!array_key_exists('argv', $_SERVER)) {
throw new Exception\UndefinedArgvException();
}
$argv = $_SERVER['argv'];
}
array_splice($argv, 1, 0, $boundArguments);
parent::__construct($argv, $definition);
}
示例9: __construct
/**
* Constructor.
*
* @param string $input An array of parameters from the CLI (in the argv format)
* @param InputDefinition $definition A InputDefinition instance
*
* @deprecated The second argument is deprecated as it does not work (will be removed in 3.0), use 'bind' method instead
*/
public function __construct($input, InputDefinition $definition = null)
{
if ($definition) {
@trigger_error('The $definition argument of the ' . __METHOD__ . ' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
}
parent::__construct(array(), null);
$this->setTokens($this->tokenize($input));
if (null !== $definition) {
$this->bind($definition);
}
}
示例10: __construct
public function __construct(array $argv = null, InputDefinition $definition = null)
{
if (null === $argv) {
$argv = $_SERVER['argv'];
}
array_shift($argv);
$this->tokens = $argv;
$this->getTemplateName();
$this->initializeTemplatePath();
parent::__construct($definition);
}
示例11: __construct
public function __construct(InputDefinition $definition = null)
{
$parameters = [$_SERVER['argv'][0], 'run'];
if (isset($_SERVER['argv'][1])) {
$filename = $this->normalizePath($_SERVER['argv'][1]);
$cwd = $this->normalizePath(getcwd()) . '/';
// IDE always provides absolute path but Codeception only accepts relative path without leading "./".
// If path is not absolute, make it that way and call realpath to remove "./".
if (strpos($filename, $cwd) !== 0 && file_exists($cwd . $filename)) {
$filename = $this->normalizePath(realpath($cwd . $filename));
}
if (!file_exists($filename)) {
echo 'File "' . $filename . '" could not be found.';
exit;
}
// Cut of the absolute part for Codeception.
$parameters[] = substr($filename, strlen($cwd));
}
parent::__construct($parameters, $definition);
}
示例12: __construct
/**
* Constructor.
*
* @param string $input An array of parameters from the CLI (in the argv format)
*/
public function __construct($input)
{
parent::__construct(array());
$this->setTokens($this->tokenize($input));
}
示例13: __construct
/**
* Creates a new parser.
*/
public function __construct()
{
// Hide the parent arguments from the public signature
parent::__construct();
}