/** * Get an item from the storage service. * * @param string $path * @param array $options * @return mixed */ public function fetchItem($path, $options = null) { $item = $this->rackspace->getObject($this->container, $path, $options); if (!$this->rackspace->isSuccessful() && $this->rackspace->getErrorCode() != '404') { throw new Exception\RuntimeException('Error on fetch: ' . $this->rackspace->getErrorMsg()); } if (!empty($item)) { return $item->getContent(); } else { return false; } }
public function testGetObject() { $object = $this->rackspace->getObject(TESTS_ZEND_SERVICE_RACKSPACE_CONTAINER_NAME, TESTS_ZEND_SERVICE_RACKSPACE_OBJECT_NAME); $this->assertTrue($object !== false); $this->assertEquals($object->getName(), TESTS_ZEND_SERVICE_RACKSPACE_OBJECT_NAME); $this->assertEquals($object->getSize(), 15); $this->assertEquals($object->getMetadata(), $this->metadata); }
/** * Get an object of the container * * @param string $name * @param array $headers * @return Zend\Service\Rackspace\Files\Object|boolean */ public function getObject($name, $headers = array()) { return $this->service->getObject($this->getName(), $name, $headers); }