src/mako/http/response/senders/File.php
protected function calculateRange(string $range)
	{
		// Remove the "range=" part of the header value

		$range = substr($range, 6);

		// Split the range starting and ending points

		$range = explode('-', $range, 2);

		// Check that the range contains two values

		if(count($range) !== 2)
		{
			return false;
		}

		// Determine start and ending points

		$end = $range[1] === '' ? $this->fileSize - 1 : $range[1];

		if($range[0] === '')
		{
			$start = $this->fileSize - $end;
			$end   = $this->fileSize - 1;
		}
		else
		{
			$start = $range[0];
		}

		$start = (int) $start;
		$end   = (int) $end;

		// Check that the range is satisfiable

		if($start > $end || $end + 1 > $this->fileSize)
		{
			return false;
		}

		// Return the range

		return ['start' => $start, 'end' => $end];
	}
protected function calculateRange(string $range)
	{
		// Remove the "range=" part of the header value

		$range = substr($range, 6);

		// Split the range starting and ending points

		$range = explode('-', $range, 2);

		// Check that the range contains two values

		if(count($range) !== 2)
		{
			return false;
		}

		// Determine start and ending points

		$end = $range[1] === '' ? $this->fileSize - 1 : $range[1];

		if($range[0] === '')
		{
			$start = $this->fileSize - $end;
			$end   = $this->fileSize - 1;
		}
		else
		{
			$start = $range[0];
		}

		$start = (int) $start;
		$end   = (int) $end;

		// Check that the range is satisfiable

		if($start > $end || $end + 1 > $this->fileSize)
		{
			return false;
		}

		// Return the range

		return ['start' => $start, 'end' => $end];
	}
protected function calculateRange ( string $ range ) { // Remove the "range=" part of the header value $ range = substr ( $ range , 6 ) ; // Split the range starting and ending points $ range = explode ( '-' , $ range , 2 ) ; // Check that the range contains two values if ( count ( $ range ) !== 2 ) { return false ; } // Determine start and ending points $ end = $ range [ 1 ] === '' ? $ this -> fileSize - 1 : $ range [ 1 ] ; if ( $ range [ 0 ] === '' ) { $ start = $ this -> fileSize - $ end ; $ end = $ this -> fileSize - 1 ; } else { $ start = $ range [ 0 ] ; } $ start = ( int ) $ start ; $ end = ( int ) $ end ; // Check that the range is satisfiable if ( $ start > $ end || $ end + 1 > $ this -> fileSize ) { return false ; } // Return the range return [ 'start' => $ start , 'end' => $ end ] ; }
Calculates the content range that should be served.

@param  string      $range Request range
@return array|false
Calculates the content range that should be served .