function ObjectConstraint::getProperty
retrieves a property from an object or array
Parameters
mixed $element Element to validate:
string $property Property to retrieve:
mixed $fallback Default value if property is not found:
Return value
mixed
2 calls to ObjectConstraint::getProperty()
- ObjectConstraint::validateElement in vendor/
justinrainbow/ json-schema/ src/ JsonSchema/ Constraints/ ObjectConstraint.php - Validates the element properties
- ObjectConstraint::validateProperties in vendor/
justinrainbow/ json-schema/ src/ JsonSchema/ Constraints/ ObjectConstraint.php - Validates the definition properties
File
-
vendor/
justinrainbow/ json-schema/ src/ JsonSchema/ Constraints/ ObjectConstraint.php, line 159
Class
- ObjectConstraint
- The ObjectConstraint Constraints, validates an object against a given schema
Namespace
JsonSchema\ConstraintsCode
protected function &getProperty(&$element, $property, $fallback = null) {
if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element))) {
return $element[$property];
}
elseif (is_object($element) && property_exists($element, $property)) {
return $element->{$property};
}
return $fallback;
}