Пример #1
0
 /**
  * List items in the given directory in the storage service
  *
  * The $path must be a directory
  *
  *
  * @param  string $path Must be a directory
  * @param  array $options
  * @return array A list of item names
  */
 public function listItems($path, $options = null)
 {
     // Options
     $returnType = self::RETURN_NAMES;
     // 1: return list of paths, 2: return raw output from underlying provider
     // Parse options
     if (is_array($options) && isset($options[self::RETURN_TYPE])) {
         $returnType = $options[self::RETURN_TYPE];
     }
     try {
         // Fetch list
         $blobList = $this->_storageClient->listBlobs($this->_container, $path);
     } catch (WindowsAzureException\ExceptionInterface $e) {
         throw new Exception\RuntimeException('Error on list: ' . $e->getMessage(), $e->getCode(), $e);
     }
     // Return
     if ($returnType == self::RETURN_LIST) {
         return $blobList;
     }
     $returnValue = array();
     foreach ($blobList as $blob) {
         $returnValue[] = $blob->Name;
     }
     return $returnValue;
 }