當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Util::emulateDirectories方法代碼示例

本文整理匯總了PHP中League\Flysystem\Util::emulateDirectories方法的典型用法代碼示例。如果您正苦於以下問題:PHP Util::emulateDirectories方法的具體用法?PHP Util::emulateDirectories怎麽用?PHP Util::emulateDirectories使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在League\Flysystem\Util的用法示例。


在下文中一共展示了Util::emulateDirectories方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: listContents

 /**
  * {@inheritdoc}
  */
 public function listContents($dirname = '', $recursive = false)
 {
     $objectsIterator = $this->client->getIterator('listObjects', ['Bucket' => $this->bucket, 'Prefix' => $this->applyPathPrefix($dirname)]);
     $contents = iterator_to_array($objectsIterator);
     $result = array_map([$this, 'normalizeResponse'], $contents);
     $result = array_filter($result, function ($value) {
         return $value['path'] !== false;
     });
     return Util::emulateDirectories($result);
 }
開發者ID:SevenMonks,項目名稱:100cities-dev,代碼行數:13,代碼來源:AwsS3Adapter.php

示例2: listContents

 /**
  * List contents of a directory.
  *
  * @param string $directory
  * @param bool   $recursive
  *
  * @return array
  */
 public function listContents($directory = '', $recursive = false)
 {
     $prefix = $this->applyPathPrefix(rtrim($directory, '/') . '/');
     $options = ['Bucket' => $this->bucket, 'Prefix' => ltrim($prefix, '/')];
     if ($recursive === false) {
         $options['Delimiter'] = '/';
     }
     $listing = $this->retrievePaginatedListing($options);
     $normalizer = [$this, 'normalizeResponse'];
     $normalized = array_map($normalizer, $listing);
     return Util::emulateDirectories($normalized);
 }
開發者ID:twistor,項目名稱:flysystem-aws-s3-v3,代碼行數:20,代碼來源:AwsS3Adapter.php

示例3: listContents

 /**
  * @inheritdoc
  */
 public function listContents($directory = '', $recursive = false)
 {
     $params = [];
     $sql = "SELECT * FROM {$this->pathTable}";
     if (!empty($directory)) {
         $sql .= " WHERE path LIKE :prefix OR path = :path";
         $params = ['prefix' => $directory . '/%', 'path' => $directory];
     }
     $stmt = $this->db->prepare($sql);
     if (!$stmt->execute($params)) {
         return [];
     }
     $rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     $rows = array_map([$this, 'normalizeMetadata'], $rows);
     if ($recursive) {
         $rows = Util::emulateDirectories($rows);
     }
     return $rows;
 }
開發者ID:phlib,項目名稱:flysystem-pdo,代碼行數:22,代碼來源:PdoAdapter.php

示例4: listContents

 /**
  * {@inheritdoc}
  */
 public function listContents($dirname = '', $recursive = false)
 {
     $dirname = rtrim($dirname, '/') . '/';
     $commandOptions = ['Bucket' => $this->bucket, 'Prefix' => $this->applyPathPrefix($dirname)];
     $iteratorOptions = [];
     if (!$recursive) {
         $commandOptions['Delimiter'] = '/';
         $iteratorOptions['return_prefixes'] = true;
     }
     $objectsIterator = $this->client->getIterator('listObjects', $commandOptions, $iteratorOptions);
     $contents = iterator_to_array($objectsIterator);
     $result = array_map([$this, 'normalizeResponse'], $contents);
     $result = array_filter($result, function ($value) {
         return $value['path'] !== false;
     });
     return Util::emulateDirectories($result);
 }
開發者ID:slion0725,項目名稱:admin_ci303,代碼行數:20,代碼來源:AwsS3Adapter.php

示例5: listContents

 /**
  * {@inheritdoc}
  */
 public function listContents($dirname = '', $recursive = false)
 {
     $bucket = $this->bucket;
     $dir = $this->listDirObjects($dirname, true);
     $contents = $dir["objects"];
     $result = array_map([$this, 'normalizeResponseOri'], $contents);
     $result = array_filter($result, function ($value) {
         return $value['path'] !== false;
     });
     return Util::emulateDirectories($result);
 }
開發者ID:aobozhang,項目名稱:aliyun-oss-adapter,代碼行數:14,代碼來源:AliyunOssAdapter.php

示例6: listContents

 /**
  * Get a file's metadata
  *
  * @param   string  $path
  * @return  array   file metadata
  */
 public function listContents($directory = '', $recursive = false)
 {
     $response = $this->container->objectList(array('prefix' => $directory));
     $response = iterator_to_array($response);
     $contents = array_map(array($this, 'normalizeObject'), $response);
     return Util::emulateDirectories($contents);
 }
開發者ID:luoshulin,項目名稱:falcon,代碼行數:13,代碼來源:Rackspace.php

示例7: listContents

 /**
  * {@inheritdoc}
  */
 public function listContents($directory = '', $recursive = false)
 {
     $directory = $this->applyPathPrefix($directory);
     // Append trailing slash only for directory other than root (which after normalization is an empty string).
     // Listing for / doesn't work properly otherwise.
     if (strlen($directory)) {
         $directory = rtrim($directory, '/') . '/';
     }
     $options = new ListBlobsOptions();
     $options->setPrefix($directory);
     if (!$recursive) {
         $options->setDelimiter('/');
     }
     /** @var ListBlobsResult $listResults */
     $listResults = $this->client->listBlobs($this->container, $options);
     $contents = [];
     foreach ($listResults->getBlobs() as $blob) {
         $contents[] = $this->normalizeBlobProperties($blob->getName(), $blob->getProperties());
     }
     if (!$recursive) {
         $contents = array_merge($contents, array_map([$this, 'normalizeBlobPrefix'], $listResults->getBlobPrefixes()));
     }
     return Util::emulateDirectories($contents);
 }
開發者ID:mat33470,項目名稱:PFA,代碼行數:27,代碼來源:AzureAdapter.php

示例8: listContents

 /**
  * List contents of a directory.
  *
  * @param string $directory
  * @param bool   $recursive
  *
  * @return array
  */
 public function listContents($directory = '', $recursive = false)
 {
     $prefix = $this->applyPathPrefix(rtrim($directory, '/') . '/');
     $options = ['Bucket' => $this->bucket, 'Prefix' => ltrim($prefix, '/')];
     $iterator = $this->s3Client->getIterator('ListObjects', $options);
     $normalizer = [$this, 'normalizeResponse'];
     $normalized = array_map($normalizer, iterator_to_array($iterator));
     return Util::emulateDirectories($normalized);
 }
開發者ID:janhartigan,項目名稱:flysystem-aws-s3-v3,代碼行數:17,代碼來源:AwsS3Adapter.php

示例9: listContents

 /**
  * List contents of a directory
  *
  * @param   string  $dirname
  * @param   bool    $recursive
  * @return  array   directory contents
  */
 public function listContents($dirname = '', $recursive = false)
 {
     if ($dirname == '') {
         $dirname = "root";
     }
     $dirname = basename($dirname);
     $parameters = array();
     $result = array();
     do {
         try {
             if (isset($pageToken)) {
                 $parameters['pageToken'] = $pageToken;
             }
             $files = $this->service->children->listChildren($dirname, $parameters);
             foreach ($files as $file) {
                 $meta = (array) $this->service->files->get($file['id'], $parameters);
                 if ($dirname == "root") {
                 } else {
                     $meta['dirname'] = $dirname;
                 }
                 $result = array_merge($result, array($meta));
             }
             //$result = array_merge($result, $files->getItems());
             $pageToken = $files->getNextPageToken();
         } catch (Exception $e) {
             print "An error occurred: " . $e->getMessage();
             $pageToken = NULL;
         }
     } while ($pageToken);
     $result = array_map(array($this, 'normalizeObject'), $result);
     return Util::emulateDirectories($result);
 }
開發者ID:xamiro-dev,項目名稱:xamiro,代碼行數:39,代碼來源:GoogleDrive.php

示例10: listContents

 /**
  * List contents of a directory
  *
  * @param   string  $dirname
  * @param   bool    $recursive
  * @return  array   directory contents
  */
 public function listContents($dirname = '', $recursive = false)
 {
     $objectsIterator = $this->client->getIterator('listObjects', array('Bucket' => $this->bucket, 'Prefix' => $this->prefix($dirname)));
     $contents = iterator_to_array($objectsIterator);
     $result = array_map(array($this, 'normalizeObject'), $contents);
     return Util::emulateDirectories($result);
 }
開發者ID:xamiro-dev,項目名稱:xamiro,代碼行數:14,代碼來源:AwsS3.php

示例11: listContents

 /**
  * List contents of a directory.
  *
  * @param string $directory
  * @param bool   $recursive
  *
  * @return array
  */
 public function listContents($directory = '', $recursive = false)
 {
     $keys = $this->client->keys($directory . '/*');
     $values = [];
     foreach ($keys as $key) {
         if (!$recursive && preg_match("|{$directory}/.+/|", $key) !== 0) {
             continue;
         }
         $stream = tmpfile();
         fwrite($stream, $this->client->get($key));
         rewind($stream);
         $values[$key] = ['mimetype' => Util::guessMimeType(stream_get_meta_data($stream)['uri'], stream_get_contents($stream)), 'type' => 'file'];
     }
     return Util::emulateDirectories($values);
 }
開發者ID:patrickrose,項目名稱:flysystem-redis,代碼行數:23,代碼來源:RedisAdapter.php

示例12: listContents

 /**
  * {@inheritdoc}
  */
 public function listContents($directory = '', $recursive = false)
 {
     $location = $this->applyPathPrefix($directory);
     $response = $this->container->objectList(['prefix' => $location]);
     $response = iterator_to_array($response);
     $contents = array_map([$this, 'normalizeObject'], $response);
     return Util::emulateDirectories($contents);
 }
開發者ID:nguyenducduy,項目名稱:phblog,代碼行數:11,代碼來源:Rackspace.php

示例13: listContents

 /**
  * {@inheritdoc}
  */
 public function listContents($directory = '', $recursive = false)
 {
     $directory = $this->applyPathPrefix($directory);
     $objects = $this->bucket->objects(['prefix' => $directory]);
     $normalised = [];
     foreach ($objects as $object) {
         $normalised[] = $this->normaliseObject($object);
     }
     return Util::emulateDirectories($normalised);
 }
開發者ID:superbalist,項目名稱:flysystem-google-storage,代碼行數:13,代碼來源:GoogleStorageAdapter.php

示例14: listContents

 /**
  * @inheritdoc
  */
 public function listContents($directory = '', $recursive = false)
 {
     $options = new ListBlobsOptions();
     $options->setPrefix($directory);
     /** @var ListBlobsResult $listResults */
     $listResults = $this->client->listBlobs($this->container, $options);
     $contents = [];
     foreach ($listResults->getBlobs() as $blob) {
         $contents[] = $this->normalizeBlobProperties($blob->getName(), $blob->getProperties());
     }
     return Util::emulateDirectories($contents);
 }
開發者ID:guiwoda,項目名稱:flysystem-azure,代碼行數:15,代碼來源:AzureAdapter.php

示例15: listContents

 /**
  * {@inheritdoc}
  */
 public function listContents($directory = '', $recursive = false)
 {
     $response = [];
     $marker = null;
     $location = $this->applyPathPrefix($directory);
     while (true) {
         $objectList = $this->client->listObjects(['Bucket' => $this->bucket, 'Prefix' => $location, 'Marker' => $marker, 'MaxKeys' => 100]);
         $objectSummarys = $objectList->getObjectSummarys();
         if (!$objectSummarys || count($objectSummarys) === 0) {
             break;
         }
         foreach ($objectSummarys as $summary) {
             if ($summary) {
                 $object = $this->getObject($this->removePathPrefix($summary->getKey()));
                 if (!$object) {
                     continue;
                 }
                 $response[] = $object;
                 $marker = $object->getKey();
             }
         }
     }
     return Util::emulateDirectories(array_map([$this, 'normalizeObject'], $response));
 }
開發者ID:hellojujian,項目名稱:aliyun-oss,代碼行數:27,代碼來源:AliyunOssAdapter.php


注:本文中的League\Flysystem\Util::emulateDirectories方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。