return $this;
} /**
* Validate the data against the validation rules (or the validation group)
* specified in the class property, $validationRules.
*
* @param array|object $data Data
*/
public function validate($data): bool
{ $rules =
$this->
getValidationRules();
if ($this->skipValidation ||
empty($rules) ||
empty($data)) { return true;
} // Validation requires array, so cast away.
if (is_object($data)) { $data =
(array) $data;
} $rules =
$this->cleanValidationRules ?
$this->
cleanValidationRules($rules,
$data) :
$rules;