示例#1
0
 /**
  * Constructor
  *
  * @param  array|Traversable $options
  * @return void
  */
 public function __construct($options = array())
 {
     if ($options instanceof Traversable) {
         $options = ArrayUtils::iteratorToArray($options);
     }
     if (!is_array($options) || empty($options)) {
         throw new Exception\InvalidArgumentException('Invalid options provided');
     }
     try {
         $this->rackspace = new RackspaceFile($options[self::USER], $options[self::API_KEY]);
     } catch (RackspaceException $e) {
         throw new Exception\RuntimeException('Error on create: ' . $e->getMessage(), $e->getCode(), $e);
     }
     if (isset($options[self::HTTP_ADAPTER])) {
         $this->rackspace->getHttpClient()->setAdapter($options[self::HTTP_ADAPTER]);
     }
     if (!empty($options[self::REMOTE_CONTAINER])) {
         $this->container = $options[self::REMOTE_CONTAINER];
     }
 }