当前位置: 首页>>代码示例>>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;未经允许,请勿转载。