Webmozart\Console\Api\Args\Format\ArgsFormat::getNumberOfArguments PHP Method

getNumberOfArguments() public method

Returns the number of arguments.
public getNumberOfArguments ( boolean $includeBase = true ) : integer
$includeBase boolean Whether to include arguments in the base format in the result.
return integer The number of arguments.
    public function getNumberOfArguments($includeBase = true)
    {
        Assert::boolean($includeBase, 'The parameter $includeBase must be a boolean. Got: %s');
        if ($this->hasMultiValuedArg) {
            return PHP_INT_MAX;
        }
        return count($this->getArguments($includeBase));
    }

Usage Example

Example #1
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testGetNumberOfArgumentsFailsIfIncludeBaseNoBoolean()
 {
     $format = new ArgsFormat();
     $format->getNumberOfArguments(1234);
 }