protected function request($method, $relativeUrl, $data = null)
    {
        $request = new Request();

        $response = $request->request($method, $relativeUrl, $data);

        if ((isset($response['entity'])) and
            ($response['entity'] == $this->getEntity()))
        {
            $this->fill($response);

            return $this;
        }
        else
        {
            return static::buildEntity($response);
        }
    }
protected function request($method, $relativeUrl, $data = null)
    {
        $request = new Request();

        $response = $request->request($method, $relativeUrl, $data);

        if ((isset($response['entity'])) and
            ($response['entity'] == $this->getEntity()))
        {
            $this->fill($response);

            return $this;
        }
        else
        {
            return static::buildEntity($response);
        }
    }
protected function request ( $ method , $ relativeUrl , $ data = null ) { $ request = new Request ( ) ; $ response = $ request -> request ( $ method , $ relativeUrl , $ data ) ; if ( ( isset ( $ response [ 'entity' ] ) ) and ( $ response [ 'entity' ] == $ this -> getEntity ( ) ) ) { $ this -> fill ( $ response ) ; return $ this ; } else { return static :: buildEntity ( $ response ) ; } }
Makes a HTTP request using Request class and assuming the API returns
formatted entity or collection result, wraps the returned JSON as entity
and returns.

@param string $method
@param string $relativeUrl
@param array  $data

@return Entity
Makes a HTTP request using Request class and assuming the API returns formatted entity or collection result wraps the returned JSON as entity and returns .