|
@@ 695-705 (lines=11) @@
|
| 692 |
|
* @return self A new instance with the specified query string. |
| 693 |
|
* @throws \InvalidArgumentException for invalid query strings. |
| 694 |
|
*/ |
| 695 |
|
public function withQuery($query) |
| 696 |
|
{ |
| 697 |
|
if (!is_string($query) && !method_exists($query, '__toString')) { |
| 698 |
|
throw new InvalidArgumentException('Uri query must be a string'); |
| 699 |
|
} |
| 700 |
|
$query = ltrim((string)$query, '?'); |
| 701 |
|
$clone = clone $this; |
| 702 |
|
$clone->query = $this->filterQuery($query); |
| 703 |
|
|
| 704 |
|
return $clone; |
| 705 |
|
} |
| 706 |
|
|
| 707 |
|
/** |
| 708 |
|
* Filters the query string or fragment of a URI. |
|
@@ 763-773 (lines=11) @@
|
| 760 |
|
* @param string $fragment The fragment to use with the new instance. |
| 761 |
|
* @return self A new instance with the specified fragment. |
| 762 |
|
*/ |
| 763 |
|
public function withFragment($fragment) |
| 764 |
|
{ |
| 765 |
|
if (!is_string($fragment) && !method_exists($fragment, '__toString')) { |
| 766 |
|
throw new InvalidArgumentException('Uri fragment must be a string'); |
| 767 |
|
} |
| 768 |
|
$fragment = ltrim((string)$fragment, '#'); |
| 769 |
|
$clone = clone $this; |
| 770 |
|
$clone->fragment = $this->filterQuery($fragment); |
| 771 |
|
|
| 772 |
|
return $clone; |
| 773 |
|
} |
| 774 |
|
|
| 775 |
|
/******************************************************************************** |
| 776 |
|
* Helpers |