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