Example #1
0
 /**
  * This method attempts to resolve the value as a null in accordance with the schema
  * definition.
  *
  * @access public
  * @static
  * @param mixed $value                                      the value to be resolved
  * @param array $definition                                 the schema definition
  * @return mixed                                            the resolved value
  * @throws Throwable\Runtime\Exception                      indicates that the value failed
  *                                                          to meet a requirement
  */
 public static function resolveNullValue($value, $definition)
 {
     if (MappingService\Data\ToolKit::isUndefined($value)) {
         if (isset($definition['required']) && $definition['required']) {
             throw new Throwable\Runtime\Exception('Invalid value defined. Expected a value that is a null, but got :type.', array(':type' => Core\DataType::info($value)->type));
         }
         return $value;
     }
     return null;
 }