Overview

Namespaces

  • OpenCloud
    • Autoscale
      • Resource
    • CloudMonitoring
      • Exception
      • Resource
    • Common
      • Collection
      • Constants
      • Exceptions
      • Http
        • Message
      • Identity
      • Log
      • Service
    • Compute
      • Constants
      • Exception
      • Resource
    • Database
      • Resource
    • DNS
      • Resource
    • LoadBalancer
      • Resource
    • ObjectStore
      • Constants
      • Exception
      • Resource
      • Upload
    • Orchestration
    • Queues
      • Exception
      • Resource
    • Volume
      • Resource
  • PHP

Classes

  • Client
  • Overview
  • Namespace
  • Class
  • Tree
  • Download
 1: <?php
 2: /**
 3:  * PHP OpenCloud library.
 4:  * 
 5:  * @copyright 2013 Rackspace Hosting, Inc. See LICENSE for information.
 6:  * @license   https://www.apache.org/licenses/LICENSE-2.0
 7:  * @author    Jamie Hannaford <jamie.hannaford@rackspace.com>
 8:  */
 9: 
10: namespace OpenCloud\Common\Http;
11: 
12: use Guzzle\Http\Client as GuzzleClient;
13: use Guzzle\Http\Curl\CurlHandle;
14: use Guzzle\Http\Curl\CurlVersion;
15: use OpenCloud\Common\Exceptions\UnsupportedVersionError;
16: 
17: /**
18:  * Base client object which handles HTTP transactions. Each service is based off of a Client which acts as a
19:  * centralized parent.
20:  */ 
21: class Client extends GuzzleClient
22: {
23:     const VERSION = '1.7.0';
24:     const MINIMUM_PHP_VERSION = '5.3.0';
25: 
26:     public function __construct($baseUrl = '', $config = null)
27:     {
28:         // @codeCoverageIgnoreStart
29:         if (PHP_VERSION < self::MINIMUM_PHP_VERSION) {
30:             throw new UnsupportedVersionError(sprintf(
31:                 'You must have PHP version >= %s installed.',
32:                 self::MINIMUM_PHP_VERSION
33:             ));
34:         }
35:         // @codeCoverageIgnoreEnd
36: 
37:         parent::__construct($baseUrl, $config);
38:     }
39:     
40:     public function getDefaultUserAgent()
41:     {
42:         return 'OpenCloud/' . self::VERSION
43:             . ' cURL/' . CurlVersion::getInstance()->get('version')
44:             . ' PHP/' . PHP_VERSION;
45:     }
46: 
47:     public function getUserAgent()
48:     {
49:         return $this->userAgent;
50:     }
51:     
52: }
PHP OpenCloud API API documentation generated by ApiGen 2.8.0