Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
71.43% covered (warning)
71.43%
5 / 7
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
Stream
71.43% covered (warning)
71.43%
5 / 7
0.00% covered (danger)
0.00%
0 / 1
5.58
0.00% covered (danger)
0.00%
0 / 1
 __construct
71.43% covered (warning)
71.43%
5 / 7
0.00% covered (danger)
0.00%
0 / 1
5.58
1<?php
2
3namespace BO\Zmsclient\Psr7;
4
5/**
6 * Layer to change PSR7 implementation if necessary
7 * @psalm-suppress PropertyNotSetInConstructor
8 */
9class Stream extends \Slim\Psr7\Stream implements \Psr\Http\Message\StreamInterface
10{
11    public function __construct(mixed $stream = null)
12    {
13        if (null === $stream) {
14            $stream = fopen('php://memory', 'w+b');
15        }
16        if (!is_resource($stream)) {
17            $stream = fopen(is_string($stream) ? $stream : 'php://memory', 'w+b');
18        }
19        if (!is_resource($stream)) {
20            throw new \RuntimeException('Unable to open stream');
21        }
22        parent::__construct($stream);
23    }
24}