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


PHP Filesystem::get方法代码示例

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


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

示例1: getPrivateKeyResource

 /**
  * @return resource
  */
 private function getPrivateKeyResource()
 {
     try {
         $file = $this->filesystem->get($this->fileName);
     } catch (FileNotFound $e) {
         $file = $this->createKeys();
     }
     $key = openssl_pkey_get_private($file->getContent());
     return $key;
 }
开发者ID:hacklabr,项目名称:login-cidadao,代码行数:13,代码来源:PublicKey.php

示例2: getChild

 /**
  * {@inheritdoc}
  */
 public function getChild($name)
 {
     $key = $this->prefix . $name;
     if (!$this->filesystem->has($key)) {
         throw new Exception\NotFound('The file with name: ' . $name . ' could not be found');
     }
     if ($this->filesystem->getAdapter()->isDirectory($key)) {
         return new self($this->filesystem, $key . '/');
     }
     return new File($this->filesystem->get($key));
 }
开发者ID:bartv2,项目名称:SecotrustSabreDavBundle,代码行数:14,代码来源:Collection.php

示例3: validateEmailAttachmentForTargetClass

 /**
  * Validate file by target entity without saving.
  *
  * @param EmailAttachment $emailAttachment
  * @param string $className
  *
  * @return \Symfony\Component\Validator\ConstraintViolationListInterface
  */
 public function validateEmailAttachmentForTargetClass(EmailAttachment $emailAttachment, $className)
 {
     if (null === $emailAttachment->getFile()) {
         $file = $this->copyEmailAttachmentToFileSystem($emailAttachment);
         $fileViolations = $this->configFileValidator->validate($className, $file);
         $this->filesystem->get($file->getFilename())->delete();
     } else {
         $file = $emailAttachment->getFile();
         $fileViolations = $this->configFileValidator->validate($className, $file);
     }
     return $fileViolations;
 }
开发者ID:Maksold,项目名称:platform,代码行数:20,代码来源:EmailAttachmentManager.php

示例4: oroToEntity

 /**
  * @param AttachmentOro $attachmentOro
  *
  * @return AttachmentEntity
  */
 public function oroToEntity(AttachmentOro $attachmentOro)
 {
     $emailAttachmentEntity = new AttachmentEntity();
     $emailAttachmentEntity->setFileName($attachmentOro->getFile()->getFilename());
     $emailAttachmentContent = new EmailAttachmentContent();
     $emailAttachmentContent->setContent(base64_encode($this->filesystem->get($attachmentOro->getFile()->getFilename())->getContent()));
     $emailAttachmentContent->setContentTransferEncoding('base64');
     $emailAttachmentContent->setEmailAttachment($emailAttachmentEntity);
     $emailAttachmentEntity->setContent($emailAttachmentContent);
     $emailAttachmentEntity->setContentType($attachmentOro->getFile()->getMimeType());
     $emailAttachmentEntity->setFile($attachmentOro->getFile());
     $emailAttachmentEntity->setFileName($attachmentOro->getFile()->getOriginalFilename());
     return $emailAttachmentEntity;
 }
开发者ID:Maksold,项目名称:platform,代码行数:19,代码来源:EmailAttachmentTransformer.php

示例5: testGetThrowsAnExceptionIfTheFileDoesNotExistAndTheCreateParameterIsSetToFalse

 public function testGetThrowsAnExceptionIfTheFileDoesNotExistAndTheCreateParameterIsSetToFalse()
 {
     $adapter = new InMemory();
     $fs = new Filesystem($adapter);
     $this->setExpectedException('InvalidArgumentException');
     $fs->get('myFile');
 }
开发者ID:ruudk,项目名称:Gaufrette,代码行数:7,代码来源:FilesystemTest.php

示例6: testResize

 public function testResize()
 {
     $image = $this->getMock('Imagine\\Image\\ImageInterface');
     $image->expects($this->once())->method('thumbnail')->will($this->returnValue($image));
     $image->expects($this->once())->method('get')->will($this->returnValue(file_get_contents(__DIR__ . '/../fixtures/logo.png')));
     $adapter = $this->getMock('Imagine\\Image\\ImagineInterface');
     $adapter->expects($this->any())->method('load')->will($this->returnValue($image));
     $media = $this->getMock('Sonata\\MediaBundle\\Model\\MediaInterface');
     $media->expects($this->exactly(2))->method('getBox')->will($this->returnValue(new Box(535, 132)));
     $filesystem = new Filesystem(new InMemory());
     $in = $filesystem->get('in', true);
     $in->setContent(file_get_contents(__DIR__ . '/../fixtures/logo.png'));
     $out = $filesystem->get('out', true);
     $resizer = new SimpleResizer($adapter, 'outbound');
     $resizer->resize($media, $in, $out, 'bar', array('height' => null, 'width' => 90, 'quality' => 100));
 }
开发者ID:novatex,项目名称:SonataMediaBundle,代码行数:16,代码来源:SimpleResizerTest.php

示例7: getOriginalFile

 /**
  * @param Media $media
  *
  * @return \Gaufrette\File
  */
 public function getOriginalFile(Media $media)
 {
     $relativePath = sprintf('/%s.%s', $media->getUuid(), ExtensionGuesser::getInstance()->guess($media->getContentType()));
     return $this->fileSystem->get($relativePath, true);
 }
开发者ID:bureaublauwgeel,项目名称:KunstmaanMediaBundle,代码行数:10,代码来源:FileHandler.php

示例8: getOriginalFile

 /**
  * @param Media $media
  *
  * @return \Gaufrette\File
  */
 public function getOriginalFile(Media $media)
 {
     return $this->fileSystem->get($this->getFilePath($media), true);
 }
开发者ID:axelvnk,项目名称:KunstmaanBundlesCMS,代码行数:9,代码来源:FileHandler.php

示例9: getJson

 /**
  * @return string
  */
 public function getJson()
 {
     return $this->filesystem->has($this->configFile) ? $this->filesystem->get($this->configFile, true)->getContent() : '{}';
 }
开发者ID:blackstylle,项目名称:satis-admin,代码行数:7,代码来源:ModelManager.php

示例10: getContent

 /**
  * Get file content
  *
  * @param File|string $file The File object or file name
  *
  * @return string
  */
 public function getContent($file)
 {
     return $this->filesystem->get($file instanceof File ? $file->getFilename() : $file)->getContent();
 }
开发者ID:Maksold,项目名称:platform,代码行数:11,代码来源:AttachmentManager.php

示例11: getContent

 /**
  * Get file content
  *
  * @param File $entity
  * @return string
  */
 public function getContent(File $entity)
 {
     return $this->filesystem->get($entity->getFilename())->getContent();
 }
开发者ID:xamin123,项目名称:platform,代码行数:10,代码来源:AttachmentManager.php

示例12: 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

示例13: get

 /**
  * Get file.
  *
  * @param $name
  * @return File
  */
 public function get($name)
 {
     return $this->filesystem->get($name);
 }
开发者ID:WeClipApp,项目名称:SRIORestUploadBundle,代码行数:10,代码来源:FileStorage.php

示例14: getImage

 /**
  * Returns raw image.
  *
  * @param string $imagePath
  *
  * @return string
  */
 public function getImage($imagePath)
 {
     return $this->files->get($imagePath)->getContent();
 }
开发者ID:Zylius,项目名称:GalerijaAPI,代码行数:11,代码来源:ImageStoreService.php

示例15: move

 /**
  * Move file to external filesystem
  *
  * @param Filesystem $filesystem File system to store file. If omitted - store in php's upload_tmp_dir
  * @param string $targetFilename New file name. If omitted - use original filename
  * @return \Gaufrette\File
  */
 public function move(Filesystem $filesystem = null, $targetFilename = null, $overwrite = true)
 {
     // source file
     $sourceFile = $this->getTransport()->getFile();
     // target base name
     $targetBasename = $this->buildTargetBasename($sourceFile, $targetFilename);
     // move file to target storage
     $content = stream_get_contents($sourceFile->getStream());
     // write file
     $filesystem->write($targetBasename, $content, $overwrite);
     return $filesystem->get($targetBasename);
 }
开发者ID:sokil,项目名称:php-upload,代码行数:19,代码来源:Handler.php


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