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


PHP Flysystem\FilesystemInterface类代码示例

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


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

示例1: FileTransferException

 function it_throws_an_exception_when_the_file_can_not_be_read_on_the_filesystem(FileInterface $file, FilesystemInterface $filesystem)
 {
     $file->getKey()->willReturn('path/to/file.txt');
     $filesystem->has('path/to/file.txt')->willReturn(true);
     $filesystem->readStream('path/to/file.txt')->willReturn(false);
     $this->shouldThrow(new FileTransferException('Unable to fetch the file "path/to/file.txt" from the filesystem.'))->during('fetch', [$file, $filesystem]);
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:7,代码来源:RawFileFetcherSpec.php

示例2: touchDir

 private function touchDir(FilesystemInterface $fs, string $entityId, string $collectionUID, string $imageId) : string
 {
     $resultPath = sprintf('%s/%s/%s', $entityId, $collectionUID, $imageId);
     if (!$fs->has($resultPath)) {
         $fs->createDir($resultPath);
     }
     return $resultPath;
 }
开发者ID:cass-project,项目名称:cass,代码行数:8,代码来源:MockAvatarStrategy.php

示例3: create

 /**
  * Create response.
  * @param  FilesystemInterface $cache Cache file system.
  * @param  string              $path  Cached file path.
  * @return Response            Response object.
  */
 public function create(FilesystemInterface $cache, $path)
 {
     $stream = $this->streamCallback->__invoke($cache->readStream($path));
     $contentType = $cache->getMimetype($path);
     $contentLength = (string) $cache->getSize($path);
     $cacheControl = 'max-age=31536000, public';
     $expires = date_create('+1 years')->format('D, d M Y H:i:s') . ' GMT';
     return $this->response->withBody($stream)->withHeader('Content-Type', $contentType)->withHeader('Content-Length', $contentLength)->withHeader('Cache-Control', $cacheControl)->withHeader('Expires', $expires);
 }
开发者ID:whismat,项目名称:glide,代码行数:15,代码来源:PsrResponseFactory.php

示例4: __construct

 /**
  * @throws FileNotFoundException If fname does not exist in filesystem
  */
 public function __construct(string $fname, FilesystemInterface $fsystem, DecoderInterface $decoder = null)
 {
     if (!$fsystem->has($fname)) {
         throw new FileNotFoundException("Unable to read file {$fname}");
     }
     $this->fname = $fname;
     $this->fsystem = $fsystem;
     $this->decoder = $decoder ?: $this->guessDecoder();
     $this->reset();
 }
开发者ID:hanneskod,项目名称:yaysondb,代码行数:13,代码来源:FlysystemEngine.php

示例5: __construct

 /**
  * @param ReflectionClass $reflection
  * @param FilesystemInterface $filesystem
  * @param null $name
  */
 public function __construct(ReflectionClass $reflection, FilesystemInterface $filesystem, $name = null)
 {
     $this->reflection = $reflection;
     $this->template = $filesystem->read("/Console/stubs/method.stub");
     $this->name = $name;
     $this->classParameters = $this->getClassParameters();
     $this->uses = $this->getUsages();
     $this->methodParameterNames = $this->getMethodParameters();
     $this->requestParameters = $this->getRequestParameters();
 }
开发者ID:ValentinGot,项目名称:trakt-api-wrapper,代码行数:15,代码来源:Method.php

示例6: deleteFile

 protected function deleteFile($filePath)
 {
     // If file is already gone somewhere, it is OK for us
     if ($this->filesystem->has($filePath) && !$this->filesystem->delete($filePath)) {
         throw new CommandErrorException('The file cannot be removed: ' . $filePath);
     }
 }
开发者ID:kivagant,项目名称:staticus-core,代码行数:7,代码来源:DestroyResourceCommand.php

示例7: assertBackups

 /**
  * Return string error message if not found to be correct
  *
  * @return string|bool
  */
 public function assertBackups($today)
 {
     $day = $today;
     $sizes = [];
     for ($i = 0; $i < 2; $i++) {
         $expected = 's77_mail_' . $day->format('Y-m-d') . '.tar.gz';
         try {
             $size = $this->filesystem->getSize($expected);
             if ($size === false) {
                 return "Kan bestandsgrootte niet ophalen van '{$expected}'";
             }
             $sizes[] = $size;
             if ($size < 3.4 * 1000 * 1000 * 1000) {
                 $humanSize = $size / 1000 / 1000;
                 return "Email backup lijkt te klein ({$humanSize} MB)";
             }
         } catch (\League\Flysystem\FileNotFoundException $e) {
             return "Kon email backup niet vinden: '{$expected}'";
         }
         $day = $day->sub(new \DateInterval('P1D'));
     }
     if (count(array_unique($sizes)) === 1) {
         return "Laatste twee e-mail backups zijn even groot.";
     }
     return true;
 }
开发者ID:roelvanduijnhoven,项目名称:backup-email-check,代码行数:31,代码来源:Assert.php

示例8: toFile

 /**
  * {@inheritdoc}
  */
 public function toFile(Workout $workout, string $outputFile) : bool
 {
     $return = $this->filesystem->put($outputFile, $this->toString($workout));
     if ($return !== true) {
         throw new Exception(sprintf('Could not write to %s', $outputFile));
     }
     return true;
 }
开发者ID:dragosprotung,项目名称:stc-core,代码行数:11,代码来源:AbstractDumper.php

示例9: testLastBackupsIdentical

 public function testLastBackupsIdentical()
 {
     $meta = $this->getMeta(123123123123.0);
     $this->fs->getSize('s77_mail_2015-04-22.tar.gz')->willReturn($meta);
     $this->fs->getSize('s77_mail_2015-04-21.tar.gz')->willReturn($meta);
     $result = $this->assert->assertBackups(new \DateTime('2015-04-22'));
     $this->assertEquals("Laatste twee e-mail backups zijn even groot.", $result);
 }
开发者ID:roelvanduijnhoven,项目名称:backup-email-check,代码行数:8,代码来源:AssertTest.php

示例10: getResource

 public function getResource($spiBinaryFileId)
 {
     try {
         return $this->filesystem->readStream($spiBinaryFileId);
     } catch (FlysystemNotFoundException $e) {
         throw new BinaryFileNotFoundException($spiBinaryFileId, $e);
     }
 }
开发者ID:Jenkosama,项目名称:ezpublish-kernel,代码行数:8,代码来源:Flysystem.php

示例11: generate

 /** @inheritdoc */
 public function generate(array $replacements, $autoloader)
 {
     ReflectionEngine::init(new Locator($autoloader));
     foreach ($replacements as $replacement) {
         $fullPath = $this->vendorDir . '/' . $replacement['package'] . '/proxy/' . str_replace('\\', '/', $replacement['originalFullyQualifiedType']) . ".php";
         $this->filesystem->put($fullPath, $this->buildClass($replacement));
     }
 }
开发者ID:brad-jones,项目名称:ppm,代码行数:9,代码来源:ProxyGenerator.php

示例12: delete

 /**
  * {@inheritdoc}
  */
 public function delete($path)
 {
     try {
         return $this->filesystem->delete($path);
     } catch (FileNotFoundException $exception) {
         return false;
     }
 }
开发者ID:svycka,项目名称:sv-images,代码行数:11,代码来源:FlySystemAdapter.php

示例13: delete

 /**
  * Delete an item from the storage if it exists.
  *
  * @param string $key
  *
  * @return void
  */
 public function delete($key)
 {
     try {
         $this->flysystem->delete($key);
     } catch (FileNotFoundException $e) {
         //
     }
 }
开发者ID:AltThree,项目名称:Storage,代码行数:15,代码来源:FlysystemStore.php

示例14: find

 /**
  * {@inheritdoc}
  */
 public function find($path)
 {
     if ($this->filesystem->has($path) === false) {
         throw new NotLoadableException(sprintf('Source image "%s" not found.', $path));
     }
     $mimeType = $this->filesystem->getMimetype($path);
     return new Binary($this->filesystem->read($path), $mimeType, $this->extensionGuesser->guess($mimeType));
 }
开发者ID:graundas,项目名称:LiipImagineBundle,代码行数:11,代码来源:FlysystemLoader.php

示例15: fromFile

 /**
  * {@inheritdoc}
  */
 public function fromFile($file) : Workout
 {
     $content = $this->filesystem->read($file);
     if ($content === false) {
         throw new UnreadableFileException();
     }
     return $this->fromString($content);
 }
开发者ID:dragosprotung,项目名称:stc-core,代码行数:11,代码来源:AbstractLoader.php


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