private function getStream($filename): StreamInterface
    {
        if ($filename instanceof StreamableInterface) {
            return $filename->getStream();
        }

        if ($filename instanceof StreamInterface) {
            return $filename;
        }

        if (is_resource($filename)) {
            return new Stream($filename, 'r');
        }

        if (!$this->files->isFile($filename)) {
            throw new ResponseException("Unable to allocate response body stream, file does not exist");
        }

        return new Stream(fopen($filename, 'r'));
    }
private function getStream($filename): StreamInterface
    {
        if ($filename instanceof StreamableInterface) {
            return $filename->getStream();
        }

        if ($filename instanceof StreamInterface) {
            return $filename;
        }

        if (is_resource($filename)) {
            return new Stream($filename, 'r');
        }

        if (!$this->files->isFile($filename)) {
            throw new ResponseException("Unable to allocate response body stream, file does not exist");
        }

        return new Stream(fopen($filename, 'r'));
    }
private function getStream ( $ filename ) : StreamInterface { if ( $ filename instanceof StreamableInterface ) { return $ filename -> getStream ( ) ; } if ( $ filename instanceof StreamInterface ) { return $ filename ; } if ( is_resource ( $ filename ) ) { return new Stream ( $ filename , 'r' ) ; } if ( ! $ this -> files -> isFile ( $ filename ) ) { throw new ResponseException ( "Unable to allocate response body stream, file does not exist" ) ; } return new Stream ( fopen ( $ filename , 'r' ) ) ; }
Create stream for given filename.

@param string|StreamInterface|StreamableInterface $filename

@return StreamInterface
Create stream for given filename .