‪TYPO3CMS  9.5
FalDumpFileContentsDecoratorStream.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
4 namespace ‪TYPO3\CMS\Core\Http;
5 
6 /*
7  * This file is part of the TYPO3 CMS project.
8  *
9  * It is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License, either version 2
11  * of the License, or any later version.
12  *
13  * For the full copyright and license information, please read the
14  * LICENSE.txt file that was distributed with this source code.
15  *
16  * The TYPO3 project - inspiring people to share!
17  */
18 
19 use GuzzleHttp\Psr7\StreamDecoratorTrait;
20 use Psr\Http\Message\StreamInterface;
22 
32 {
33  use StreamDecoratorTrait;
34 
38  protected ‪$identifier;
39 
43  protected ‪$driver;
44 
48  protected ‪$size;
49 
56  {
57  $this->identifier = ‪$identifier;
58  $this->driver = ‪$driver;
59  $this->size = ‪$size;
60  }
61 
66  public function ‪emit()
67  {
68  $this->driver->dumpFileContents($this->identifier);
69  }
70 
77  protected function ‪createStream(): StreamInterface
78  {
79  $stream = new ‪Stream('php://temp', 'rw');
80  $stream->write($this->driver->getFileContents($this->identifier));
81  return $stream;
82  }
83 
87  public function ‪getSize(): int
88  {
89  return ‪$this->size;
90  }
91 
95  public function ‪isWritable(): bool
96  {
97  return false;
98  }
99 
104  public function ‪write($string)
105  {
106  throw new \RuntimeException('Cannot write to a ' . self::class, 1538331852);
107  }
108 }
‪TYPO3\CMS\Core\Http\FalDumpFileContentsDecoratorStream\getSize
‪int getSize()
Definition: FalDumpFileContentsDecoratorStream.php:84
‪TYPO3\CMS\Core\Http\FalDumpFileContentsDecoratorStream\emit
‪emit()
Definition: FalDumpFileContentsDecoratorStream.php:63
‪TYPO3\CMS\Core\Resource\Driver\DriverInterface
Definition: DriverInterface.php:22
‪TYPO3\CMS\Core\Http\FalDumpFileContentsDecoratorStream\isWritable
‪bool isWritable()
Definition: FalDumpFileContentsDecoratorStream.php:92
‪TYPO3\CMS\Core\Http\FalDumpFileContentsDecoratorStream\__construct
‪__construct(string $identifier, DriverInterface $driver, int $size)
Definition: FalDumpFileContentsDecoratorStream.php:52
‪TYPO3\CMS\Core\Http\FalDumpFileContentsDecoratorStream\createStream
‪StreamInterface createStream()
Definition: FalDumpFileContentsDecoratorStream.php:74
‪TYPO3\CMS\Core\Http\FalDumpFileContentsDecoratorStream\$identifier
‪string $identifier
Definition: FalDumpFileContentsDecoratorStream.php:37
‪TYPO3\CMS\Core\Http\Stream
Definition: Stream.php:28
‪TYPO3\CMS\Core\Http\FalDumpFileContentsDecoratorStream\write
‪write($string)
Definition: FalDumpFileContentsDecoratorStream.php:101
‪TYPO3\CMS\Core\Http\FalDumpFileContentsDecoratorStream\$driver
‪DriverInterface $driver
Definition: FalDumpFileContentsDecoratorStream.php:41
‪TYPO3\CMS\Core\Http\SelfEmittableStreamInterface
Definition: SelfEmittableStreamInterface.php:27
‪TYPO3\CMS\Core\Http\FalDumpFileContentsDecoratorStream
Definition: FalDumpFileContentsDecoratorStream.php:32
‪TYPO3\CMS\Core\Http\FalDumpFileContentsDecoratorStream\$size
‪int $size
Definition: FalDumpFileContentsDecoratorStream.php:45
‪TYPO3\CMS\Core\Http
Definition: AbstractApplication.php:3