Exemplo n.º 1
0
        if ($responseFormat != 'responsejson' && sizeOf($json['success']) != 1) {
            var_dump($json);
            throw new Exception("{$uctype} creation failed");
        }
        if ($responseFormat == 'responsejson') {
            return $json;
        }
        $key = array_shift($json['success']);
        if ($responseFormat == 'key') {
            return $key;
        }
        $func = 'get' . $uctype . 'XML';
        $xml = self::$func($key, $context);
        if ($responseFormat == 'atom') {
            return $xml;
        }
        $data = self::parseDataFromAtomEntry($xml);
        if ($responseFormat == 'data') {
            return $data;
        }
        if ($responseFormat == 'content') {
            return $data['content'];
        }
        if ($responseFormat == 'json') {
            return json_decode($data['content'], true);
        }
        throw new Exception("Invalid response format '{$responseFormat}'");
    }
}
API2::loadConfig();