mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
Development
- Added new Redirect method to SimpleRouter class. - Changed method-names in InputHandler for better description. - Fixed return-types for InputHandler for collections. - Added unit-tests for InputHandler (get, post). - Optimisations.
This commit is contained in:
+19
-4
@@ -14,7 +14,7 @@ class Url implements \JsonSerializable
|
||||
private $username;
|
||||
private $password;
|
||||
private $path;
|
||||
private $params;
|
||||
private $params = [];
|
||||
private $fragment;
|
||||
|
||||
/**
|
||||
@@ -43,9 +43,7 @@ class Url implements \JsonSerializable
|
||||
$this->fragment = $data['fragment'] ?? null;
|
||||
|
||||
if (isset($data['query']) === true) {
|
||||
$params = [];
|
||||
parse_str($data['query'], $params);
|
||||
$this->setParams($params);
|
||||
$this->setQueryString($data['query']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,6 +238,23 @@ class Url implements \JsonSerializable
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set raw query-string parameters as string
|
||||
*
|
||||
* @param string $queryString
|
||||
* @return static
|
||||
*/
|
||||
public function setQueryString(string $queryString): self
|
||||
{
|
||||
$params = [];
|
||||
|
||||
if(parse_str($queryString, $params) !== false) {
|
||||
return $this->setParams($params);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get query-string params as string
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user