當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。