本文整理汇总了PHP中Gaufrette\Filesystem::createStream方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::createStream方法的具体用法?PHP Filesystem::createStream怎么用?PHP Filesystem::createStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gaufrette\Filesystem
的用法示例。
在下文中一共展示了Filesystem::createStream方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getArchive
/**
* {@inheritdoc}
*/
public function getArchive(JobExecution $jobExecution, $key)
{
$archives = $this->getArchives($jobExecution);
if (!isset($archives[$key])) {
throw new \InvalidArgumentException(sprintf('Key "%s" does not exist', $key));
}
return $this->filesystem->createStream($archives[$key]);
}
示例2: copyStreamToStorage
/**
* Copy stream to storage
*
* @param Stream $srcStream
* @param string $destinationFileName
*/
protected function copyStreamToStorage(Stream $srcStream, $destinationFileName)
{
$dstStream = $this->filesystem->createStream($destinationFileName);
$srcStream->open(new StreamMode('rb+'));
$dstStream->open(new StreamMode('wb+'));
while (!$srcStream->eof()) {
$dstStream->write($srcStream->read(self::READ_COUNT));
}
$dstStream->close();
$srcStream->close();
}
示例3: copyLocalFileToStorage
/**
* Copy file from local filesystem to attachment storage with new name
*
* @param string $localFilePath
* @param string $destinationFileName
*/
public function copyLocalFileToStorage($localFilePath, $destinationFileName)
{
$src = new LocalStream($localFilePath);
$dst = $this->filesystem->createStream($destinationFileName);
$src->open(new StreamMode('rb+'));
$dst->open(new StreamMode('wb+'));
while (!$src->eof()) {
$dst->write($src->read(100000));
}
$dst->close();
$src->close();
}
示例4: let
/**
* @param \Gaufrette\FilesystemMap $map
* @param \Gaufrette\Filesystem $filesystem
* @param \Gaufrette\Stream $stream
*/
function let($map, $filesystem, $stream)
{
$filesystem->createStream('filename')->willReturn($stream);
$map->get('some')->willReturn($filesystem);
$this->setFilesystemMap($map);
}
示例5: getStream
/**
* Get a stream from file.
*
* @param $name
* @return \Gaufrette\Stream|\Gaufrette\Stream\InMemoryBuffer
*/
public function getStream($name)
{
return $this->filesystem->createStream($name);
}