Esempio n. 1
0
 /**
  * Validates array against schema.
  *
  *
  * @return ValidatorResult
  */
 public function validate()
 {
     $schema = $this->getSchema();
     $validator = new Volan($schema);
     $validator->setParams(['client' => $this->getClient()]);
     return $validator->validate($this->toArray());
 }
Esempio n. 2
0
 /**
  * Validates array against schema.
  *
  * Sets error if validation fails.
  *
  * @param array|object $arr
  * @param bool  $requiredMode
  *
  * @return ValidatorResult
  */
 public function validate($arr, $requiredMode = true)
 {
     $schema = $this->getSchema();
     $validator = new Volan($schema);
     $validator->setRequiredMode($requiredMode);
     $validator->setParams(['client' => $this->getClient()]);
     return $validator->validate($arr);
 }