/** * (non-PHPdoc) * @see ObjectStorage_Abstract::get() */ public function get($limit = 100, $marker = '') { parent::get($limit, $marker); if ($this->response->getBody() == '') { return $this; } switch (strtoupper($this->mime)) { case ObjectStorage::MIME_JSON: $objects = json_decode($this->response->getBody()); if (count($objects) > 0) { foreach ($objects as $object) { if ($this->context == ObjectStorage_Abstract::CONTEXT_SEARCH) { $path = $object->type == 'container' ? $object->container : $object->container . '/' . $object->name; } else { $path = $this->path . '/' . (isset($object->name) ? $object->name : (isset($object->subdir) ? $object->subdir : '')); } $this->appendData($this->objectStorage->with($path)); } } break; case ObjectStorage::MIME_XML: // @todo implement this $data = simplexml_load_string($this->response->getBody()); $loopData = count($data->object) > 0 ? $data->object : (count($data->container) > 0 ? $data->container : array()); if (count($loopData) > 0) { if ($this->context == ObjectStorage_Abstract::CONTEXT_SEARCH) { foreach ($loopData as $object) { $path = (string) $object->type == 'container' ? $object->container : $object->container . '/' . $object->name; $this->appendData($this->objectStorage->with($path)); } } else { foreach ($loopData as $object) { $this->appendData($this->objectStorage->with($this->path . '/' . (string) $object->name)); } } } break; default: // plain/text $objects = explode("\n", trim($this->response->getBody(), "\n")); if (count($objects) > 0) { $path = $this->path == '' ? '' : trim($this->path, '/') . '/'; foreach ($objects as $object) { $this->appendData($this->objectStorage->with($path . $object)); } } } if ($this->context == ObjectStorage_Abstract::CONTEXT_SEARCH) { $this->containerCount = count($this->containers); $this->objectCount = count($this->objects); } return $this; }