original_string: protected function _fileRange($file, $httpRange)
      {
          $fileSize = $file->size();
          $lastByte = $fileSize - 1;
          $start = 0;
          $end = $lastByte;
  
          preg_match('/^bytes\s*=\s*(\d+)?\s*-\s*(\d+)?$/', $httpRange, $matches);
          if ($matches) {
              $start = $matches[1];
              $end = isset($matches[2]) ? $matches[2] : '';
          }
  
          if ($start === '') {
              $start = $fileSize - $end;
              $end = $lastByte;
          }
          if ($end === '') {
              $end = $lastByte;
          }
  
          if ($start > $end || $end > $lastByte || $start > $lastByte) {
              $this->_setStatus(416);
              $this->_setHeader('Content-Range', 'bytes 0-' . $lastByte . '/' . $fileSize);
  
              return;
          }
  
          $this->_setHeader('Content-Length', $end - $start + 1);
          $this->_setHeader('Content-Range', 'bytes ' . $start . '-' . $end . '/' . $fileSize);
          $this->_setStatus(206);
          $this->_fileRange = [$start, $end];
      }
code: protected function _fileRange($file, $httpRange)
      {
          $fileSize = $file->size();
          $lastByte = $fileSize - 1;
          $start = 0;
          $end = $lastByte;
  
          preg_match('/^bytes\s*=\s*(\d+)?\s*-\s*(\d+)?$/', $httpRange, $matches);
          if ($matches) {
              $start = $matches[1];
              $end = isset($matches[2]) ? $matches[2] : '';
          }
  
          if ($start === '') {
              $start = $fileSize - $end;
              $end = $lastByte;
          }
          if ($end === '') {
              $end = $lastByte;
          }
  
          if ($start > $end || $end > $lastByte || $start > $lastByte) {
              $this->_setStatus(416);
              $this->_setHeader('Content-Range', 'bytes 0-' . $lastByte . '/' . $fileSize);
  
              return;
          }
  
          $this->_setHeader('Content-Length', $end - $start + 1);
          $this->_setHeader('Content-Range', 'bytes ' . $start . '-' . $end . '/' . $fileSize);
          $this->_setStatus(206);
          $this->_fileRange = [$start, $end];
      }
code_tokens: protected function _fileRange ( $ file , $ httpRange ) { $ fileSize = $ file -> size ( ) ; $ lastByte = $ fileSize - 1 ; $ start = 0 ; $ end = $ lastByte ; preg_match ( '/^bytes\s*=\s*(\d+)?\s*-\s*(\d+)?$/' , $ httpRange , $ matches ) ; if ( $ matches ) { $ start = $ matches [ 1 ] ; $ end = isset ( $ matches [ 2 ] ) ? $ matches [ 2 ] : '' ; } if ( $ start === '' ) { $ start = $ fileSize - $ end ; $ end = $ lastByte ; } if ( $ end === '' ) { $ end = $ lastByte ; } if ( $ start > $ end || $ end > $ lastByte || $ start > $ lastByte ) { $ this -> _setStatus ( 416 ) ; $ this -> _setHeader ( 'Content-Range' , 'bytes 0-' . $ lastByte . '/' . $ fileSize ) ; return ; } $ this -> _setHeader ( 'Content-Length' , $ end - $ start + 1 ) ; $ this -> _setHeader ( 'Content-Range' , 'bytes ' . $ start . '-' . $ end . '/' . $ fileSize ) ; $ this -> _setStatus ( 206 ) ; $ this -> _fileRange = [ $ start , $ end ] ; }
docstring: Apply a file range to a file and set the end offset.
  
  If an invalid range is requested a 416 Status code will be used
  in the response.
  
  @param \Cake\Filesystem\File $file The file to set a range on.
  @param string $httpRange The range to use.
  @return void
  @deprecated 3.4.0 Long term this needs to be refactored to follow immutable paradigms.
  However for now, it is simpler to leave this alone.
docstring_tokens: Apply a file range to a file and set the end offset .