original_string: public function request($url, array $options = array())
      {
          $options += array(
              'data' => null,
              'timeout' => 30,
              'context' => null,
              'method' => 'GET',
              'headers' => array()
          );
  
          if ($options['method'] === 'POST' && empty($options['headers'])) {
              $options['headers'] = array('Content-Type' => 'application/x-www-form-urlencoded');
          }
  
          if (!empty($options['query'])) {
              $url = strtok($url, '?') . '?' . http_build_query($options['query']);
          }
  
          return $this->setUri($url)
              ->setHeaders($options['headers'])
              ->setMethod($options['method'])
              ->setData($options['data'])
              ->setTimeOut($options['timeout'])
              ->setContext($options['context'])
              ->setSocket()
              ->exec()
              ->getFormattedResponse();
      }
code: public function request($url, array $options = array())
      {
          $options += array(
              'data' => null,
              'timeout' => 30,
              'context' => null,
              'method' => 'GET',
              'headers' => array()
          );
  
          if ($options['method'] === 'POST' && empty($options['headers'])) {
              $options['headers'] = array('Content-Type' => 'application/x-www-form-urlencoded');
          }
  
          if (!empty($options['query'])) {
              $url = strtok($url, '?') . '?' . http_build_query($options['query']);
          }
  
          return $this->setUri($url)
              ->setHeaders($options['headers'])
              ->setMethod($options['method'])
              ->setData($options['data'])
              ->setTimeOut($options['timeout'])
              ->setContext($options['context'])
              ->setSocket()
              ->exec()
              ->getFormattedResponse();
      }
code_tokens: public function request ( $ url , array $ options = array ( ) ) { $ options += array ( 'data' => null , 'timeout' => 30 , 'context' => null , 'method' => 'GET' , 'headers' => array ( ) ) ; if ( $ options [ 'method' ] === 'POST' && empty ( $ options [ 'headers' ] ) ) { $ options [ 'headers' ] = array ( 'Content-Type' => 'application/x-www-form-urlencoded' ) ; } if ( ! empty ( $ options [ 'query' ] ) ) { $ url = strtok ( $ url , '?' ) . '?' . http_build_query ( $ options [ 'query' ] ) ; } return $ this -> setUri ( $ url ) -> setHeaders ( $ options [ 'headers' ] ) -> setMethod ( $ options [ 'method' ] ) -> setData ( $ options [ 'data' ] ) -> setTimeOut ( $ options [ 'timeout' ] ) -> setContext ( $ options [ 'context' ] ) -> setSocket ( ) -> exec ( ) -> getFormattedResponse ( ) ; }
docstring: Shortcut method to perform an HTTP request
  @param string $url
  @param array $options
  @return array
docstring_tokens: Shortcut method to perform an HTTP request