public static function getDocumentIdFromLocation($location)
    {
        if (!is_string($location)) {
            // can't do anything about it if location is not even a string
            return null;
        }

        if (0 === strpos($location, '/_db/')) {
            // /_db/<dbname>/_api/document/<collection>/<key>
            @list(, , , , , $collectionName, $id) = explode('/', $location);
        } else {
            // /_api/document/<collection>/<key>
            @list(, , , $collectionName, $id) = explode('/', $location);
        }

        if (is_string($id)) {
            $id = urldecode($id);
        }

        return $collectionName . '/' . $id;
    }
public static function getDocumentIdFromLocation($location)
    {
        if (!is_string($location)) {
            // can't do anything about it if location is not even a string
            return null;
        }

        if (0 === strpos($location, '/_db/')) {
            // /_db/<dbname>/_api/document/<collection>/<key>
            @list(, , , , , $collectionName, $id) = explode('/', $location);
        } else {
            // /_api/document/<collection>/<key>
            @list(, , , $collectionName, $id) = explode('/', $location);
        }

        if (is_string($id)) {
            $id = urldecode($id);
        }

        return $collectionName . '/' . $id;
    }
public static function getDocumentIdFromLocation ( $ location ) { if ( ! is_string ( $ location ) ) { // can't do anything about it if location is not even a string return null ; } if ( 0 === strpos ( $ location , '/_db/' ) ) { // /_db/<dbname>/_api/document/<collection>/<key> @ list ( , , , , , $ collectionName , $ id ) = explode ( '/' , $ location ) ; } else { // /_api/document/<collection>/<key> @ list ( , , , $ collectionName , $ id ) = explode ( '/' , $ location ) ; } if ( is_string ( $ id ) ) { $ id = urldecode ( $ id ) ; } return $ collectionName . '/' . $ id ; }
Get the document id from a location header

@param string $location - HTTP response location header

@return string - document id parsed from header
Get the document id from a location header