-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStream.php
More file actions
41 lines (36 loc) · 994 Bytes
/
Stream.php
File metadata and controls
41 lines (36 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/*
* This file is part of Berlioz framework.
*
* @license https://opensource.org/licenses/MIT MIT License
* @copyright 2021 Ronan GIRON
* @author Ronan GIRON <https://github.com/ElGigi>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code, to the root.
*/
declare(strict_types=1);
namespace Berlioz\Http\Message;
use Berlioz\Http\Message\Stream\AbstractStream;
use RuntimeException;
/**
* Class Stream.
*/
class Stream extends AbstractStream
{
/**
* Stream constructor.
*
* @param resource $fp
*
* @throws RuntimeException If parameter isn't a resource or null value
*/
public function __construct($fp = null)
{
if (null !== $fp && !is_resource($fp)) {
throw new RuntimeException('Parameter must be a resource type or null value.');
}
$fp === null && $fp = fopen('php://temp', 'r+');
$this->fp = $fp;
}
}