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


PHP Filesystem::listKeys方法代码示例

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


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

示例1: getFiles

 /** @inheritDoc */
 public function getFiles($path = '')
 {
     $keys = $this->gaufrette->listKeys($this->getGaufrettePath($path));
     $files = new ArrayCollection($keys['keys']);
     return $files->map(function ($path) {
         return new File($this, $path);
     });
 }
开发者ID:ibou77,项目名称:elgg,代码行数:9,代码来源:GaufretteDirectory.php

示例2: getArchives

 /**
  * {@inheritdoc}
  */
 public function getArchives(JobExecution $jobExecution)
 {
     $archives = array();
     $keys = $this->filesystem->listKeys(dirname($this->getRelativeArchivePath($jobExecution)));
     foreach ($keys['keys'] as $key) {
         $archives[basename($key)] = $key;
     }
     return $archives;
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:12,代码来源:AbstractFilesystemArchiver.php

示例3: getChildren

 /**
  * {@inheritdoc}
  */
 public function getChildren()
 {
     $children = array();
     $keys = $this->filesystem->listKeys($this->prefix);
     foreach ($this->getDirectories($keys['dirs']) as $dir) {
         $children[] = $this->getChild($dir);
     }
     foreach ($this->getFiles($keys['keys']) as $file) {
         $children[] = $this->getChild($file);
     }
     return $children;
 }
开发者ID:bartv2,项目名称:SecotrustSabreDavBundle,代码行数:15,代码来源:Collection.php

示例4: getFiles

 /**
  * @param $path
  * @return array|\Cocoders\FileSource\File[]
  */
 public function getFiles($path)
 {
     $listedKeys = $this->filesystem->listKeys($path);
     $files = [];
     foreach ($listedKeys['keys'] as $key) {
         $filePath = $this->tmpPath . '/' . $key;
         $this->createBaseDirectory($filePath);
         if ($this->isNotInRootDir($filePath)) {
             file_put_contents($filePath, $this->filesystem->read($key));
             $files[] = new File($filePath);
         }
     }
     return $files;
 }
开发者ID:partikus,项目名称:FileArchive,代码行数:18,代码来源:GaufretteFileSource.php

示例5: getFiles

 /**
  * Recursively list the files in the given directory path.
  * 
  * @param string $path The directory path on this filesystem
  * 
  * @return File[] 
  */
 public function getFiles($path = '')
 {
     $keys = $this->gaufrette->listKeys($this->getGaufrettePath($path));
     $filesystem = $this;
     return array_map(function ($path) use($filesystem) {
         return new File($filesystem, $path);
     }, $keys['keys']);
 }
开发者ID:sephiroth88,项目名称:Elgg,代码行数:15,代码来源:Filesystem.php

示例6:

 function it_saves_content_of_files_from_gaufrette_at_local_disk(Filesystem $filesystem)
 {
     $filesystem->listKeys('test')->willReturn(['keys' => ['test/aaa/z.txt', 'test/aaa/test2.txt', 'test.txt'], 'dirs' => ['test/aaa']]);
     $filesystem->read('test/aaa/z.txt')->willReturn('Some content');
     $filesystem->read('test/aaa/test2.txt')->willReturn('Other text content');
     $files = $this->getFiles('test');
     $files[0]->shouldBeAnInstanceOf('Cocoders\\FileSource\\File');
     $files[0]->shouldHaveContent('Some content');
     $files[1]->shouldBeAnInstanceOf('Cocoders\\FileSource\\File');
     $files[1]->shouldHaveContent('Other text content');
 }
开发者ID:partikus,项目名称:FileArchive,代码行数:11,代码来源:GaufretteFileSourceSpec.php

示例7: iShouldSeeIn

 /**
  * @Then I should see :fileKey
  * @Then I should see :fileKey in :key
  */
 public function iShouldSeeIn($fileKey, $key = '')
 {
     $outputArray = [];
     $list = new RecursiveIteratorIterator(new RecursiveArrayIterator($this->filesystem->listKeys($key)));
     foreach ($list as $sub) {
         $subArray = $list->getSubIterator();
         if ($subArray === $fileKey) {
             $outputArray[] = iterator_to_array($subArray);
         }
     }
     return count($outputArray) > 0;
 }
开发者ID:akovalyov,项目名称:gaufrette-integration-tests,代码行数:16,代码来源:FeatureContext.php

示例8: execute

 /**
  * @param string $targetPath
  * @param array $replacePatterns
  * @return mixed|void
  */
 public function execute($targetPath = '', array $replacePatterns = array())
 {
     $adapter = new LocalAdapter($targetPath);
     $filesystem = new Filesystem($adapter);
     $listKeys = $filesystem->listKeys();
     if (count($replacePatterns) > 0) {
         foreach ($listKeys['keys'] as $file) {
             if (!@strstr(mime_content_type($targetPath . $file), 'image') && !@strstr($file, '.git') && !@strstr($file, '.svn')) {
                 $filesystem->write($file, $this->replaceContent($replacePatterns, $filesystem->read($file)), TRUE);
             }
         }
     }
 }
开发者ID:kj187,项目名称:typo3-helper,代码行数:18,代码来源:RenameContentTask.php

示例9: fetchRemoteFilesAction

 /**
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 protected function fetchRemoteFilesAction(Request $request)
 {
     $provider = InputHelper::string($request->request->get('provider'));
     $path = InputHelper::string($request->request->get('path', ''));
     $dispatcher = $this->factory->getDispatcher();
     $name = AssetEvents::ASSET_ON_REMOTE_BROWSE;
     if (!$dispatcher->hasListeners($name)) {
         return $this->sendJsonResponse(array('success' => 0));
     }
     /** @var \Mautic\PluginBundle\Helper\IntegrationHelper $integrationHelper */
     $integrationHelper = $this->factory->getHelper('integration');
     /** @var \Mautic\PluginBundle\Integration\AbstractIntegration $integration */
     $integration = $integrationHelper->getIntegrationObject($provider);
     $event = new RemoteAssetBrowseEvent($integration);
     $dispatcher->dispatch($name, $event);
     if (!($adapter = $event->getAdapter())) {
         return $this->sendJsonResponse(array('success' => 0));
     }
     $connector = new Filesystem($adapter);
     $output = $this->renderView('MauticAssetBundle:Remote:list.html.php', array('connector' => $connector, 'integration' => $integration, 'items' => $connector->listKeys($path)));
     return $this->sendJsonResponse(array('success' => 1, 'output' => $output));
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:26,代码来源:AjaxController.php

示例10: fileAction

 /**
  * Get Virtual Files Action
  *
  * @param string $file
  *
  * @throws NotFoundHttpException
  * @return Response
  */
 public function fileAction($file = null)
 {
     if (null == $file) {
         return $this->redirect($this->generateUrl('vfs_files', array('file' => '/')));
     }
     $cacheDirectory = $this->getParameter('adapter_cache_dir');
     $local = new LocalAdapter($cacheDirectory, true);
     $localadapter = new LocalAdapter($this->getParameter('adapter_files'));
     $adapter = new CacheAdapter($localadapter, $local, 3600);
     $fsAvatar = new Filesystem($adapter);
     if ($this->endswith($file, '/')) {
         if ($fsAvatar->has($file)) {
             $this->gvars['title'] = $this->translate('indexof', array('%dir%' => $this->generateUrl('vfs_files', array('file' => $file))));
             $this->gvars['pagetitle'] = $this->translate('indexof_raw', array('%dir%' => $this->generateUrl('vfs_files', array('file' => $file))));
             $path = substr($file, 1);
             $fs = $fsAvatar->listKeys($path);
             $listfiles = array();
             foreach ($fs['dirs'] as $key) {
                 $fulldir = $key . '/';
                 $dirname = $key;
                 if (substr($key, 0, strlen($path)) == $path) {
                     $dirname = substr($dirname, strlen($path));
                 }
                 if (!strstr($dirname, '/')) {
                     $listfiles[$fulldir] = $dirname;
                 }
             }
             foreach ($fs['keys'] as $key) {
                 $fullfile = $key;
                 $filename = $key;
                 if (substr($key, 0, strlen($path)) == $path) {
                     $filename = substr($filename, strlen($path));
                 }
                 if (!strstr($filename, '/')) {
                     $listfiles[$fullfile] = $filename;
                 }
             }
             $this->gvars['fs'] = $listfiles;
             return $this->renderResponse('AcfResBundle:Vfs:list_files.html.twig', $this->gvars);
         } else {
             throw new NotFoundHttpException();
         }
     }
     if ($fsAvatar->has($file)) {
         if ($fsAvatar->getAdapter()->isDirectory($file)) {
             $file .= '/';
             return $this->redirect($this->generateUrl('vfs_files', array('file' => $file)));
         }
         $reqFile = $fsAvatar->get($file);
         $response = new Response();
         $response->headers->set('Content-Type', 'binary');
         $response->setContent($reqFile->getContent());
         return $response;
     } else {
         throw new NotFoundHttpException();
     }
 }
开发者ID:sasedev,项目名称:acf-expert,代码行数:65,代码来源:VfsController.php


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