You are here

class EasyRdf_Http in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Http.php \EasyRdf_Http

Static class to set the HTTP client used by EasyRdf

@package EasyRdf @copyright Copyright (c) 2009-2013 Nicholas J Humfrey @license http://www.opensource.org/licenses/bsd-license.php

Hierarchy

Expanded class hierarchy of EasyRdf_Http

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Http.php, line 46

View source
class EasyRdf_Http {

  /** The default HTTP Client object */
  private static $defaultHttpClient = null;

  /** Set the HTTP Client object used to fetch RDF data
   *
   * @param  EasyRdf_Http_Client|Zend_Http_Client $httpClient The new HTTP client object
   * @return EasyRdf_Http_Client|Zend_Http_Client The new HTTP client object
   */
  public static function setDefaultHttpClient($httpClient) {
    if (!is_object($httpClient) or !($httpClient instanceof Zend_Http_Client or $httpClient instanceof EasyRdf_Http_Client)) {
      throw new InvalidArgumentException("\$httpClient should be an object of class Zend_Http_Client or EasyRdf_Http_Client");
    }
    return self::$defaultHttpClient = $httpClient;
  }

  /** Get the HTTP Client object used to fetch RDF data
   *
   * If no HTTP Client has previously been set, then a new
   * default (EasyRdf_Http_Client) client will be created.
   *
   * @return EasyRdf_Http_Client|Zend_Http_Client The HTTP client object
   */
  public static function getDefaultHttpClient() {
    if (!isset(self::$defaultHttpClient)) {
      self::$defaultHttpClient = new EasyRdf_Http_Client();
    }
    return self::$defaultHttpClient;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EasyRdf_Http::$defaultHttpClient private static property The default HTTP Client object
EasyRdf_Http::getDefaultHttpClient public static function Get the HTTP Client object used to fetch RDF data
EasyRdf_Http::setDefaultHttpClient public static function Set the HTTP Client object used to fetch RDF data