phplibrary/src/Url.php

27 lines
No EOL
504 B
PHP

<?php
namespace ctiso;
class Url {
public $parts = [];
public $parent/*: Url*/;
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(array_merge($this->parts, $this->parent ? $this->parent->parts : []));
}
}