public function has($collection)
    {
        $collection = $this->makeCollection($collection);

        try {
            // will throw ServerException if entry could not be retrieved
            $this->get($collection);

            return true;
        } catch (ServerException $e) {
            // we are expecting a 404 to return boolean false
            if ($e->getCode() === 404) {
                return false;
            }

            // just rethrow
            throw $e;
        }
    }
public function has($collection)
    {
        $collection = $this->makeCollection($collection);

        try {
            // will throw ServerException if entry could not be retrieved
            $this->get($collection);

            return true;
        } catch (ServerException $e) {
            // we are expecting a 404 to return boolean false
            if ($e->getCode() === 404) {
                return false;
            }

            // just rethrow
            throw $e;
        }
    }
public function has ( $ collection ) { $ collection = $ this -> makeCollection ( $ collection ) ; try { // will throw ServerException if entry could not be retrieved $ this -> get ( $ collection ) ; return true ; } catch ( ServerException $ e ) { // we are expecting a 404 to return boolean false if ( $ e -> getCode ( ) === 404 ) { return false ; } // just rethrow throw $ e ; } }
Check if a collection exists

This will call self::get() internally and checks if there
was an exception thrown which represents an 404 request.

@throws Exception When any other error than a 404 occurs

@param  mixed $collection - collection id as a string or number

@return boolean
Check if a collection exists