public function get($object_id)
    {
        if ( !empty( $this->getValues() ) ) {
            throw new AlreadyFetchedObjectException('Object already contains values, get() not possible, use a new object');
        }

        if ( empty($object_id) ) {
            throw new \RuntimeException('Missing object ID');
        }

        $url = $this->getURL(
            'get',
            [
                'object_id' => $object_id,
            ]
        );

        $response = $this->getClient()->get(
            $url,
            [
                'expand' => true,
            ]
        );

        if ( $response->hasError() ) {
            $this->setError( $response->getError() );
        }
        else {
            $this->clearError();
            $this->setRemoteData( $response->getData() );
        }

        return $this;
    }
public function get($object_id)
    {
        if ( !empty( $this->getValues() ) ) {
            throw new AlreadyFetchedObjectException('Object already contains values, get() not possible, use a new object');
        }

        if ( empty($object_id) ) {
            throw new \RuntimeException('Missing object ID');
        }

        $url = $this->getURL(
            'get',
            [
                'object_id' => $object_id,
            ]
        );

        $response = $this->getClient()->get(
            $url,
            [
                'expand' => true,
            ]
        );

        if ( $response->hasError() ) {
            $this->setError( $response->getError() );
        }
        else {
            $this->clearError();
            $this->setRemoteData( $response->getData() );
        }

        return $this;
    }
public function get ( $ object_id ) { if ( ! empty ( $ this -> getValues ( ) ) ) { throw new AlreadyFetchedObjectException ( 'Object already contains values, get() not possible, use a new object' ) ; } if ( empty ( $ object_id ) ) { throw new \ RuntimeException ( 'Missing object ID' ) ; } $ url = $ this -> getURL ( 'get' , [ 'object_id' => $ object_id , ] ) ; $ response = $ this -> getClient ( ) -> get ( $ url , [ 'expand' => true , ] ) ; if ( $ response -> hasError ( ) ) { $ this -> setError ( $ response -> getError ( ) ) ; } else { $ this -> clearError ( ) ; $ this -> setRemoteData ( $ response -> getData ( ) ) ; } return $ this ; }
Fetches object data for given object ID.

@param mixed $object_id      ID of object to fetch, false value or omit to fetch all objects.

@return object               This object.
Fetches object data for given object ID .