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


PHP Filesystem::updateStream方法代码示例

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


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

示例1: writeStream

 public function writeStream($path, $resource)
 {
     try {
         return $this->filesystem->writeStream($path, $resource);
     } catch (FileExistsException $exception) {
         return $this->filesystem->updateStream($path, $resource);
     }
 }
开发者ID:devhelp,项目名称:backup,代码行数:8,代码来源:TargetFlysystemAdapter.php

示例2: testUpdateStream

 /**
  * 1.txt
  * 2.txt.
  */
 public function testUpdateStream()
 {
     $stream = tmpfile();
     fwrite($stream, 'OSS text2');
     rewind($stream);
     $this->assertTrue($this->filesystem->updateStream('2.txt', $stream));
     fclose($stream);
 }
开发者ID:apollopy,项目名称:flysystem-aliyun-oss,代码行数:12,代码来源:AliyunOssAdapterTest.php

示例3:

 function it_should_successfully_update_stream($path, Filesystem $filesystem)
 {
     $filesystem->writeStream($path, 'resource2')->willThrow('League\\Flysystem\\FileExistsException');
     $filesystem->updateStream($path, 'resource2')->willReturn(true);
     $this->writeStream($path, 'resource2');
     $filesystem->writeStream($path, 'resource2')->shouldBeCalled();
     $filesystem->updateStream($path, 'resource2')->shouldBeCalled();
 }
开发者ID:devhelp,项目名称:backup,代码行数:8,代码来源:TargetFlysystemAdapterSpec.php

示例4: testUpdateStreamFail

 /**
  * @expectedException InvalidArgumentException
  */
 public function testUpdateStreamFail()
 {
     $adapter = Mockery::mock('League\\Flysystem\\AdapterInterface');
     $adapter->shouldReceive('has')->andReturn(true);
     $filesystem = new Filesystem($adapter);
     $filesystem->updateStream('file.txt', 'not a resource');
 }
开发者ID:xamiro-dev,项目名称:xamiro,代码行数:10,代码来源:FlysystemStreamTests.php

示例5: updateStream

 /**
  * @inheritdoc
  */
 public function updateStream($path, $resource, array $config = [])
 {
     try {
         return $this->fileSystem->updateStream($this->getInnerPath($path), $resource, $config);
     } catch (FileNotFoundException $e) {
         throw $this->exceptionWrapper($e, $path);
     }
 }
开发者ID:petrknap,项目名称:php-filestorage,代码行数:11,代码来源:FileSystem.php

示例6: updateStream

 /**
  * Update an existing file using a stream.
  *
  * @param string   $path     The path of the existing file.
  * @param resource $resource The file handle.
  * @param array    $config   An optional configuration array.
  *
  * @throws InvalidArgumentException If $resource is not a file handle.
  * @throws FileNotFoundException
  *
  * @return bool True on success, false on failure.
  */
 public function updateStream($path, $resource, array $config = [])
 {
     $result = parent::updateStream($path, $resource, $config);
     if ($result && ($resource = $this->get($path))) {
         return $this->dispatch(new SyncFile($resource));
     }
     return $result;
 }
开发者ID:ramcda,项目名称:files-module,代码行数:20,代码来源:AdapterFilesystem.php

示例7: testUpdateStreamInvalid

 public function testUpdateStreamInvalid()
 {
     $this->setExpectedException('InvalidArgumentException');
     $this->filesystem->updateStream('path.txt', '__INVALID__');
 }
开发者ID:mechiko,项目名称:staff-october,代码行数:5,代码来源:FilesystemTests.php

示例8: updateStream

 /**
  * @inheritdoc
  */
 public function updateStream($path, $resource, array $config = [])
 {
     try {
         return parent::updateStream($path, $resource, $config);
     } catch (\Exception $e) {
         $this->errors[] = $e->getMessage();
     }
     return false;
 }
开发者ID:romeoz,项目名称:rock-file,代码行数:12,代码来源:FileManager.php


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