code: private function castToArray($input): array
      {
          $result = array();
  
          foreach ($input as $key => $value) {
              $result[$key] = $this->castValue($value);
          }
  
          return $result;
      }
docs: Recursively cast to array
  
  @param  mixed $input
  
  @return array