Изменен механизм расширения ссылок. Избавление от глобальных переменных
This commit is contained in:
parent
524b27936a
commit
40fad0e75b
11 changed files with 77 additions and 61 deletions
18
src/Url.php
18
src/Url.php
|
|
@ -3,13 +3,25 @@
|
|||
namespace ctiso;
|
||||
|
||||
class Url {
|
||||
public $parts;
|
||||
public $parts = [];
|
||||
public $parent;
|
||||
|
||||
function __construct($parts = []) {
|
||||
function __construct() {
|
||||
}
|
||||
|
||||
function setParent($parent) {
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
function setQuery($parts) {
|
||||
$this->parts = $parts;
|
||||
}
|
||||
|
||||
function addQueryParam($key, $value) {
|
||||
$this->parts[$key] = $value;
|
||||
}
|
||||
|
||||
function toString() {
|
||||
return '?' . http_build_query($this->parts);
|
||||
return '?' . http_build_query(array_merge($this->parts, $this->parent->parts));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue