Skip to content

Commit

Permalink
refactor: remove unneeded override
Browse files Browse the repository at this point in the history
The parent method is fixed.
  • Loading branch information
kenjis committed Jun 29, 2023
1 parent b5e0548 commit bd02333
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions system/HTTP/SiteURI.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,36 +252,6 @@ public function getRoutePath(): string
return $this->routePath;
}

/**
* Returns the value of a specific segment of the URI path.
* Allows to get only existing segments or the next one.
*
* @param int $number Segment number starting at 1
* @param string $default Default value
*
* @return string The value of the segment. If you specify the last +1
* segment, the $default value. If you specify the last +2
* or more throws HTTPException.
*
* @TODO remove this method after merging #7267
*/
public function getSegment(int $number, string $default = ''): string
{
if ($number < 1) {
throw HTTPException::forURISegmentOutOfRange($number);
}

if ($number > count($this->segments) + 1 && ! $this->silent) {
throw HTTPException::forURISegmentOutOfRange($number);
}

// The segment should treat the array as 1-based for the user
// but we still have to deal with a zero-based array.
$number--;

return $this->segments[$number] ?? $default;
}

/**
* Formats the URI as a string.
*/
Expand Down

0 comments on commit bd02333

Please sign in to comment.