/** * Converts a response from the IXF API to the corresponding PHP object. * * @param array $resp The response from the IXF API. * @return Object|array */ public static function convertToIxfObject($resp) { if (self::isList($resp)) { $mapped = array(); foreach ($resp as $k => $i) { array_push($mapped, self::convertToIxfObject($i)); } return $mapped; } elseif (is_array($resp)) { $type = null; if (isset($resp['_id'])) { $type = substr($resp['_id'], 0, strpos($resp['_id'], ".")); } $class = ApiResource::resolveClassName($type); return Object::scopedConstructFrom($class, $resp); } else { return $resp; } }