public static function createFromRequest(StreamInterface $stream, ServerRequestInterface $request = null)
    {
        $result = [];
        if ($request === null) {
            $headers = \tao_helpers_Http::getHeaders();
            $rangeHeader = isset($headers['Range']) ? [$headers['Range']] : null;
        } else {
            $rangeHeader = $request->hasHeader('Range') ? $request->getHeader('Range') : null;
        }
        if ($rangeHeader) {
            $ranges = explode(',', $rangeHeader[0]);
            foreach($ranges as $range) {
                $range = str_replace('bytes=', '', $range);
                $result[] = new StreamRange($stream, $range);
            }
        }
        return $result;
    }
public static function createFromRequest(StreamInterface $stream, ServerRequestInterface $request = null)
    {
        $result = [];
        if ($request === null) {
            $headers = \tao_helpers_Http::getHeaders();
            $rangeHeader = isset($headers['Range']) ? [$headers['Range']] : null;
        } else {
            $rangeHeader = $request->hasHeader('Range') ? $request->getHeader('Range') : null;
        }
        if ($rangeHeader) {
            $ranges = explode(',', $rangeHeader[0]);
            foreach($ranges as $range) {
                $range = str_replace('bytes=', '', $range);
                $result[] = new StreamRange($stream, $range);
            }
        }
        return $result;
    }
public static function createFromRequest ( StreamInterface $ stream , ServerRequestInterface $ request = null ) { $ result = [ ] ; if ( $ request === null ) { $ headers = \ tao_helpers_Http :: getHeaders ( ) ; $ rangeHeader = isset ( $ headers [ 'Range' ] ) ? [ $ headers [ 'Range' ] ] : null ; } else { $ rangeHeader = $ request -> hasHeader ( 'Range' ) ? $ request -> getHeader ( 'Range' ) : null ; } if ( $ rangeHeader ) { $ ranges = explode ( ',' , $ rangeHeader [ 0 ] ) ; foreach ( $ ranges as $ range ) { $ range = str_replace ( 'bytes=' , '' , $ range ) ; $ result [ ] = new StreamRange ( $ stream , $ range ) ; } } return $ result ; }
Create array of StreamRange instances based on current request range headers
@param StreamInterface $stream
@param ServerRequestInterface $request
@throws StreamRangeException
@return StreamRange[]
Create array of StreamRange instances based on current request range headers