Example #1
0
 /**
  * @param string $schema A schema file to load from the configured schema path
  * @param array $input
  *
  * @return array|bool|Result
  * @throws InvalidConstraintException
  * @throws InvalidInputException
  * @throws ValidationException
  *
  */
 public static function validate($schema, array $input)
 {
     $instance = new self($input, self::getSchema($schema));
     if ($instance->execute()) {
         return new Result($instance->getCleanedData(), $instance->getViolations());
     } else {
         throw new InvalidInputException($instance->getViolations());
     }
 }