/**
  * Recursively deserialize an array of (property) values. Use callbacks to further deserialize more complicated
  * values.
  *
  * @param array $values
  * @param array $callbacks
  * @return array
  */
 public static function deserialize(array $values, array $callbacks = [])
 {
     $deserializedData = [];
     foreach ($values as $property => $value) {
         if (isset($callbacks[$property])) {
             if (is_array($value) && ArrayHelper::isNumericallyIndexed($value)) {
                 $value = array_map($callbacks[$property], $value);
             } elseif ($value !== null) {
                 // if $value is null, we don't call the callable, since its type-hint may then cause a fatal error
                 $value = $callbacks[$property]($value);
             }
         }
         $deserializedData[$property] = $value;
     }
     return $deserializedData;
 }
 /**
  * @test
  */
 public function an_array_with_a_non_integer_key_is_not_numerically_indexed()
 {
     $this->assertFalse(ArrayHelper::isNumericallyIndexed(['first_key' => 'first value']));
 }