/** * Get the value of a given property from an instance. * * @param mixed &$object Instance of a type which * contains this property. * @param ResourceType &$resourceType Resource type instance * containing metadata about * the instance. * @param ResourceProperty &$resourceProperty Resource property instance * containing metadata about the * property whose value * to be retrieved. * * @return mixed The value of the given property. * * @throws ODataException If reflection exception occured * while trying to access the property. */ protected function getPropertyValue(&$object, ResourceType &$resourceType, ResourceProperty &$resourceProperty) { try { $reflectionProperty = new \ReflectionProperty($object, $resourceProperty->getName()); $propertyValue = $reflectionProperty->getValue($object); return $propertyValue; } catch (\ReflectionException $reflectionException) { throw ODataException::createInternalServerError(Messages::objectModelSerializerFailedToAccessProperty($resourceProperty->getName(), $resourceType->getName())); } }