Check if an allowed '--only=xx' command is called.

@param array $args
@return void
331694
protected function _validateModuleFilterArgument(array $args) {
        $only           = self::FILTER_MODULE_COMMAND;
        $allowedFilters = $this->getAllowedFilters();
        $filter = array_key_exists($only, $args)
            ? strtolower($args[$only])
            : null
        ;

        if ($filter && !in_array($filter, $allowedFilters)) {
            $error = sprintf(self::ERROR_ILLEGAL_MODULE_FILTER, $args[$only]);
            $error .= "\nTry: " . implode(", ", $this->getAllowedFilters());
            throw new Exception($error);
        }
    }
327644
public function executeAll(...$args)
    {
        if ($this->isEmpty()) {
            return 0;
        }
        $n = 0;
        do {
            $cb = $this->extract();
            if ($cb) {
                $cb(...$args);
                ++$n;
            }
        } while (!$this->isEmpty());
        return $n;
    }
478
public function find_subcommand( &$args ) {
		$name = array_shift( $args );

		$subcommands = $this->get_subcommands();

		if ( ! isset( $subcommands[ $name ] ) ) {
			$aliases = self::get_aliases( $subcommands );

			if ( isset( $aliases[ $name ] ) ) {
				$name = $aliases[ $name ];
			}
		}

		if ( ! isset( $subcommands[ $name ] ) ) {
			return false;
		}

		return $subcommands[ $name ];
	}
915259
private function containHelpOption($args)
    {
        return array_key_exists(self::HELP_OPTION, $args)
                || array_key_exists(self::HELP_SHORTOPTION, $args);
    }
914549
private function cmdHelp($args)
    {
        $help = isset($args[1]) ? $args[1] : 'help';
        $file = __DIR__.'/../help/'.$help.'.txt';

        if (!file_exists($file)) {
            return $this->error('&help-not-found');
        }

        echo file_get_contents(__DIR__.'/../help/'.$help.'.txt');
    }
77738
public function call($args = [])
    {
        if (count($args) == 0 || empty($args[2]))
            throw new NoticeException('Command "'.$this->key.'": Expecting a name.');

        $this->setName($args[2]);
    }
999499
protected function handleValues(array $args)
    {
        if (\count($args) === 1) {
            $values = $args[0];
        } else {
            $values = [];

            foreach ($args as $i => $arg) {
                $values['Value ' . ($i + 1)] = $arg;
            }
        }

        return $values;
    }
607149
public function matchArgs($args)
    {
        if ($this->_args === null || $args === null) {
            return true;
        }
        $arg = $this->_classes['arg'];
        foreach ($this->_args as $expected) {
            $actual = array_shift($args);
            if ($expected instanceof $arg) {
                if (!$expected->match($actual)) {
                    return false;
                }
            } elseif ($actual !== $expected) {
                return false;
            }
        }
        return true;
    }
1009574
private function _execute($args = array())
    {
        if ($this->_err) {
            return false;
        };
        if ($this->_sth) {
            if ($this->_sth->execute($args)) {
                return true;
            } else {
                $this->_err = implode(' ', $this->_sth->errorInfo());
                return false;
            };
        } else {
            $this->_err = "No statement to execute.";
        };
        return false;
    }
518361
public static function findCommandValue($args) {
		$args = explode("|",$args);
		foreach ($args as $arg) {
			if (isset(self::$options[$arg])) {
				return self::$options[$arg];
			}
		}
		return false;
	}
695336
public function gcdm( $args )
	 {
		if( count( $args ) )
		{
			$min = $this->min( $args );
			for( $i=$min; $i>0; $i-- )
			{
				$a = true;
				foreach( $args as $arg )
					if( $arg % $i != 0 )
						$a = false;
				if( $a )
					return $i;
			}
		}
		return false;
	}
103580
public function validate($args)
    {
        $matched = false;

        //validates arguments
        foreach ($args as $arg => $value) {
            //non-named option are skipped from validation
            if (is_numeric($arg)) continue;
            //validates action options
            foreach ($this->options as $option) {
                //checks if options matches specified parameter
                if ($option->matchParam($arg)) {
                    //validates option
                    if (!$option->validate($value)) {
                        throw new InvalidArgumentException($arg, $value);
                    }
                    $matched = true;
                }
            }
            if (!$matched) {
                throw new InvalidOptionException($arg);
            }
        }
        //validates required options
        foreach ($this->options as $option) {
            if (!$option->isRequired()) {
                continue;
            }

            if (!$option->getValue($args)) {
                throw new MissingRequiredArgumentException($option->getName());
            }
        }

        return true;
    }
1313470
public function display(array $args = array()) {
        if (empty($args)) {
            Garp_Cli::errorOut('The least you can do is provide a text...');
        } else {
            $text = implode(' ', $args);
            $figlet = new Zend_Text_Figlet();
            Garp_Cli::lineOut($figlet->render($text));
        }
        return true;
    }
869529
public function filter_arguments( $arg ) {
		$patterns = array(
			'url=', 'path=', 'user=', 'skip-plugins=?', 'skip-themes=?',
			'require=', 'no-color', 'color', 'prompt', 'allow-root',
		);

		foreach ( $patterns as $pattern ) {
			if ( preg_match( "~^--{$pattern}~i", $arg ) ) {
				return false;
			}
		}

		return true;
	}
365681
public function command($args)
    {
        // Throw if no arguments provided and args less than 2
        if (empty($args) || count($args) < 2) {
            throw new RuntimeException("Invalid argument count");
        }

        $secondArg = $args[1];

        // Output the second argument
        return $secondArg;

    }
493574
public static function isValidFieldOccurrence ($arg) 
    {
        if ($arg === null || ctype_digit($arg)) {
            $arg = (int)$arg;
        }
        return is_int($arg) && $arg >= 0 && $arg < 100;
    }
400606
public function executeOne(...$args)
    {
        if ($this->isEmpty()) {
            return false;
        }
        $cb = $this->extract();
        if ($cb) {
            $cb(...$args);
        }
        return true;
    }