private static function createStream($file = 'php://temp', $mode = 'r+')
    {
        $factory = Middleware::getStreamFactory();
        $replacing = null;

        if ($file instanceof StreamInterface) {
            $replacing = $file;
            $file = 'php://temp';
        }

        if ($factory === null) {
            if (class_exists('Zend\\Diactoros\\Stream')) {
                return new \Zend\Diactoros\Stream($file, $mode);
            }

            throw new \RuntimeException('Unable to create a stream. No stream factory defined');
        }

        return call_user_func($factory, $file, $mode, $replacing);
    }
private static function createStream($file = 'php://temp', $mode = 'r+')
    {
        $factory = Middleware::getStreamFactory();
        $replacing = null;

        if ($file instanceof StreamInterface) {
            $replacing = $file;
            $file = 'php://temp';
        }

        if ($factory === null) {
            if (class_exists('Zend\\Diactoros\\Stream')) {
                return new \Zend\Diactoros\Stream($file, $mode);
            }

            throw new \RuntimeException('Unable to create a stream. No stream factory defined');
        }

        return call_user_func($factory, $file, $mode, $replacing);
    }
private static function createStream ( $ file = 'php://temp' , $ mode = 'r+' ) { $ factory = Middleware :: getStreamFactory ( ) ; $ replacing = null ; if ( $ file instanceof StreamInterface ) { $ replacing = $ file ; $ file = 'php://temp' ; } if ( $ factory === null ) { if ( class_exists ( 'Zend\\Diactoros\\Stream' ) ) { return new \ Zend \ Diactoros \ Stream ( $ file , $ mode ) ; } throw new \ RuntimeException ( 'Unable to create a stream. No stream factory defined' ) ; } return call_user_func ( $ factory , $ file , $ mode , $ replacing ) ; }
Get the stream factory.

@param string|StreamInterface $file Filename or stream it's replacing
@param string                 $mode

@return StreamInterface
Get the stream factory .