当前位置: 首页>>代码示例>>PHP>>正文


PHP Util::pathinfo方法代码示例

本文整理汇总了PHP中League\Flysystem\Util::pathinfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::pathinfo方法的具体用法?PHP Util::pathinfo怎么用?PHP Util::pathinfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在League\Flysystem\Util的用法示例。


在下文中一共展示了Util::pathinfo方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: storeContents

 /**
  * {@inheritdoc}
  */
 public function storeContents($directory, array $contents, $recursive)
 {
     if ($recursive) {
         return $contents;
     }
     foreach ($contents as $index => $object) {
         $pathinfo = Util::pathinfo($object['path']);
         $object = array_merge($pathinfo, $object);
         if (!$recursive && $object['dirname'] !== $directory) {
             unset($contents[$index]);
             continue;
         }
         $contents[$index] = $object;
     }
     return $contents;
 }
开发者ID:bogolubov,项目名称:owncollab_talks-1,代码行数:19,代码来源:Noop.php

示例2: testMetaGetters

 /**
  * @dataProvider metaGetterProvider
  *
  * @param $method
  * @param $key
  * @param $value
  */
 public function testMetaGetters($method, $key, $value)
 {
     $cache = new Memory();
     $this->assertFalse($cache->{$method}('path.txt'));
     $cache->updateObject('path.txt', $object = ['path' => 'path.txt', 'type' => 'file', $key => $value] + Util::pathinfo('path.txt'), true);
     $this->assertEquals($object, $cache->{$method}('path.txt'));
     $this->assertEquals($object, $cache->getMetadata('path.txt'));
 }
开发者ID:nao-pon,项目名称:flysystem-cached-adapter,代码行数:15,代码来源:MemoryCacheTests.php

示例3: normalizeResponse

 /**
  * Normalize the object result array.
  *
  * @param array  $response
  * @param string $path
  *
  * @return array
  */
 protected function normalizeResponse(array $response, $path = null)
 {
     $result = ['path' => $path ?: $this->removePathPrefix($response['Key'])];
     $result = array_merge($result, Util::pathinfo($result['path']));
     if (isset($response['LastModified'])) {
         $result['timestamp'] = strtotime($response['LastModified']);
     }
     if (substr($result['path'], -1) === '/') {
         $result['type'] = 'dir';
         $result['path'] = rtrim($result['path'], '/');
         return $result;
     }
     return array_merge($result, Util::map($response, static::$resultMap), ['type' => 'file']);
 }
开发者ID:janhartigan,项目名称:flysystem-aws-s3-v3,代码行数:22,代码来源:AwsS3Adapter.php

示例4: listContents

 /**
  * {@inheritdoc}
  */
 public function listContents($directory = '', $recursive = false)
 {
     $directory = Util::normalizePath($directory);
     $contents = $this->getAdapter()->listContents($directory, $recursive);
     $mapper = function ($entry) use($directory, $recursive) {
         if ($entry['path'] === false && (!empty($directory) && strpos($entry['path'], $directory) === false)) {
             return false;
         }
         $entry = $entry + Util::pathinfo($entry['path']);
         if ($recursive === false && Util::dirname($entry['path']) !== $directory) {
             return false;
         }
         return $entry;
     };
     $listing = array_values(array_filter(array_map($mapper, $contents)));
     usort($listing, function ($a, $b) {
         return strcasecmp($a['path'], $b['path']);
     });
     return $listing;
 }
开发者ID:RyanThompson,项目名称:flysystem,代码行数:23,代码来源:Filesystem.php

示例5: ensureParentDirectories

 /**
  * Ensure parent directories of an object
  *
  * @param   string  $path  object path
  */
 public function ensureParentDirectories($path)
 {
     $object = $this->cache[$path];
     while ($object['dirname'] !== '' && !isset($this->cache[$object['dirname']])) {
         $object = Util::pathinfo($object['dirname']);
         $object['type'] = 'dir';
         $this->cache[$object['path']] = $object;
     }
 }
开发者ID:luoshulin,项目名称:falcon,代码行数:14,代码来源:AbstractCache.php

示例6: listContents

 /**
  * List the filesystem contents.
  *
  * @param string $directory
  * @param bool   $recursive
  *
  * @return array contents
  */
 public function listContents($directory = '', $recursive = false)
 {
     $directory = Util::normalizePath($directory);
     $contents = $this->adapter->listContents($directory, $recursive);
     $mapper = function ($entry) use($directory, $recursive) {
         $entry = $entry + Util::pathinfo($entry['path']);
         if (!empty($directory) && strpos($entry['path'], $directory) === false) {
             return false;
         }
         if ($recursive === false && Util::dirname($entry['path']) !== $directory) {
             return false;
         }
         return $entry;
     };
     return array_values(array_filter(array_map($mapper, $contents)));
 }
开发者ID:aleksabp,项目名称:bolt,代码行数:24,代码来源:Filesystem.php

示例7: addPathInfo

 private function addPathInfo(array $entry)
 {
     return $entry + Util::pathinfo($entry['path']);
 }
开发者ID:Ceciceciceci,项目名称:MySJSU-Class-Registration,代码行数:4,代码来源:ContentListingFormatter.php

示例8: getPathInfo

 protected function getPathInfo($path)
 {
     $info = Util::pathinfo('/' . Util::normalizePath($path));
     $info['path'] = ltrim($info['path'], '/');
     $info['dirname'] = ltrim($info['dirname'], '/');
     if (empty($info['basename'])) {
         $info['basename'] = '.';
     }
     return $info;
 }
开发者ID:danhunsaker,项目名称:flysystem-redis,代码行数:10,代码来源:RedisAdapter.php

示例9: listContents

 /**
  * @inheritdoc
  */
 public function listContents($directory = '', $recursive = false)
 {
     $directory = Util::normalizePath($directory);
     $adapter = $this->getAdapter();
     $separator = $adapter instanceof Local ? DIRECTORY_SEPARATOR : '/';
     $contents = $adapter->listContents($directory, $recursive);
     $mapper = function ($entry) use($directory, $recursive, $separator) {
         if (strlen($entry['path']) === 0 || !empty($directory) && strpos($entry['path'], $directory . $separator) === false || $recursive === false && Util::dirname($entry['path']) !== $directory) {
             return false;
         }
         return $entry + Util::pathinfo($entry['path']);
     };
     $listing = array_values(array_filter(array_map($mapper, $contents)));
     usort($listing, function ($a, $b) {
         return strcasecmp($a['path'], $b['path']);
     });
     return $listing;
 }
开发者ID:shinichi81,项目名称:simpleAuth,代码行数:21,代码来源:Filesystem.php

示例10: testListContents

 public function testListContents()
 {
     $rawListing = [['path' => 'other_root/file.txt'], ['path' => 'valid/to_deep/file.txt'], ['path' => 'valid/file.txt']];
     $expected = [Util::pathinfo('valid/file.txt')];
     $this->prophecy->listContents('valid', false)->willReturn($rawListing);
     $output = $this->filesystem->listContents('valid', false);
     $this->assertEquals($expected, $output);
 }
开发者ID:mechiko,项目名称:staff-october,代码行数:8,代码来源:FilesystemTests.php

示例11: listContents

 /**
  * @inheritdoc
  */
 public function listContents($directory = '', $recursive = false)
 {
     $directory = Util::normalizePath($directory);
     $contents = $this->getAdapter()->listContents($directory, $recursive);
     $filter = function (array $entry) use($directory, $recursive) {
         if (empty($entry['path']) && $entry['path'] !== '0') {
             return false;
         }
         if ($recursive) {
             return $directory === '' || strpos($entry['path'], $directory . '/') === 0;
         }
         return Util::dirname($entry['path']) === $directory;
     };
     $mapper = function (array $entry) {
         return $entry + Util::pathinfo($entry['path']);
     };
     $listing = array_values(array_map($mapper, array_filter($contents, $filter)));
     usort($listing, function ($a, $b) {
         return strcasecmp($a['path'], $b['path']);
     });
     return $listing;
 }
开发者ID:iwillhappy1314,项目名称:laravel-admin,代码行数:25,代码来源:Filesystem.php


注:本文中的League\Flysystem\Util::pathinfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。