Изменен механизм расширения ссылок. Избавление от глобальных переменных

This commit is contained in:
CORP\phedor 2018-04-18 18:20:56 +03:00
parent 524b27936a
commit 40fad0e75b
11 changed files with 77 additions and 61 deletions

View file

@ -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));
}
}