src/Api/Validator.php
public function validate($name, Shape $shape, array $input)
    {
        $this->dispatch($shape, $input);

        if ($this->errors) {
            $message = sprintf(
                "Found %d error%s while validating the input provided for the "
                    . "%s operation:\n%s",
                count($this->errors),
                count($this->errors) > 1 ? 's' : '',
                $name,
                implode("\n", $this->errors)
            );
            $this->errors = [];

            throw new \InvalidArgumentException($message);
        }
    }
public function validate($name, Shape $shape, array $input)
    {
        $this->dispatch($shape, $input);

        if ($this->errors) {
            $message = sprintf(
                "Found %d error%s while validating the input provided for the "
                    . "%s operation:\n%s",
                count($this->errors),
                count($this->errors) > 1 ? 's' : '',
                $name,
                implode("\n", $this->errors)
            );
            $this->errors = [];

            throw new \InvalidArgumentException($message);
        }
    }
public function validate ( $ name , Shape $ shape , array $ input ) { $ this -> dispatch ( $ shape , $ input ) ; if ( $ this -> errors ) { $ message = sprintf ( "Found %d error%s while validating the input provided for the " . "%s operation:\n%s" , count ( $ this -> errors ) , count ( $ this -> errors ) > 1 ? 's' : '' , $ name , implode ( "\n" , $ this -> errors ) ) ; $ this -> errors = [ ] ; throw new \ InvalidArgumentException ( $ message ) ; } }
Validates the given input against the schema.

@param string $name  Operation name
@param Shape  $shape Shape to validate
@param array  $input Input to validate

@throws \InvalidArgumentException if the input is invalid.
Validates the given input against the schema .