public function check($value, $schema)
{
if (is_object($schema)) {
// check object properties
if (is_object($value)) {
$this->checkObject($value, isset($schema->entity) ? $schema->entity : $schema);
}
// check items
if (is_array($value)) {
$this->checkItems($value, $schema);
}
//check property types
if (is_scalar($value) || empty($value)) {
$this->checkProperty($value, $schema);
}
// check required field
if (isset($schema->required)) {
$this->checkRequired($value, $schema);
}
} else {
$value = is_array($value) ? get_object_vars(array_shift($value)) : get_object_vars($value);
$this->appendError(implode(' ,', array_keys($value)), ' properties doesn\'t exist in api definitions');
}
}