public function getSegment(int $number): string
	{
		// The segment should treat the array as 1-based for the user
		// but we still have to deal with a zero-based array.
		$number -= 1;

		if ($number > count($this->segments))
		{
			throw HTTPException::forURISegmentOutOfRange($number);
		}

		return $this->segments[$number] ?? '';
	}
public function getSegment(int $number): string
	{
		// The segment should treat the array as 1-based for the user
		// but we still have to deal with a zero-based array.
		$number -= 1;

		if ($number > count($this->segments))
		{
			throw HTTPException::forURISegmentOutOfRange($number);
		}

		return $this->segments[$number] ?? '';
	}
public function getSegment ( int $ number ) : string { // The segment should treat the array as 1-based for the user // but we still have to deal with a zero-based array. $ number -= 1 ; if ( $ number > count ( $ this -> segments ) ) { throw HTTPException :: forURISegmentOutOfRange ( $ number ) ; } return $ this -> segments [ $ number ] ?? '' ; }
Returns the value of a specific segment of the URI path.

@param integer $number

@return string     The value of the segment. If no segment is found,
throws InvalidArgumentError
Returns the value of a specific segment of the URI path .