Webmozart\Console\Api\Args\Format\ArgsFormatBuilder::hasRequiredArgument PHP Method

hasRequiredArgument() public method

Returns whether the builder contains a required argument.
public hasRequiredArgument ( boolean $includeBase = true ) : boolean
$includeBase boolean Whether to include arguments in the base format in the search.
return boolean Returns `true` if the builder contains a required argument and `false` otherwise.
    public function hasRequiredArgument($includeBase = true)
    {
        Assert::boolean($includeBase, 'The parameter $includeBase must be a boolean. Got: %s');
        if (!$this->hasOptionalArg && count($this->arguments) > 0) {
            return true;
        }
        if ($includeBase && $this->baseFormat) {
            return $this->baseFormat->hasRequiredArgument();
        }
        return false;
    }

Usage Example

 /**
  * @expectedException \InvalidArgumentException
  */
 public function testHasRequiredArgumentFailsIfIncludeBaseNoBoolean()
 {
     $this->builder->hasRequiredArgument(1234);
 }