protected function validate(&$value)
{
if ($this->isNull($value)) {
return $this;
}
if (!$this->isArray($value) && !$this->isArrayObject($value)) {
$this->expected('array or ArrayObject', gettype($value));
}
$value = StdObjectWrapper::toArray($value);
if (!array_key_exists('lat', $value) || !array_key_exists('lng', $value)) {
$ex = new ValidationException(ValidationException::VALIDATION_FAILED);
$ex->addError($this->attribute, 'GeoPointAttribute value must contain `lat` and `lng`');
throw $ex;
}
}