ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
LSUrlBuilder.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
6
10class LSUrlBuilder implements URLBuilder
11{
12 const PARAM_LSO_COMMAND = 'lsocmd';
13 const PARAM_LSO_PARAMETER = 'lsov';
14
15 public function __construct(ILIAS\Data\URI $base_url)
16 {
17 $this->base_url = $base_url;
18 }
19
20 public function getURL(string $command, int $param = null) : ILIAS\Data\URI
21 {
22 $query = $this->base_url->getQuery();
23 if (!$query) {
24 $params = [];
25 } else {
26 parse_str($this->base_url->getQuery(), $params);
27 }
28
29 $params[self::PARAM_LSO_COMMAND] = $command;
30 if (is_null($param)) {
31 unset($params[self::PARAM_LSO_PARAMETER]);
32 } else {
34 }
35 $url = $this->base_url->withQuery(http_build_query($params));
36 return $url;
37 }
38
39 public function getHref(string $command, int $param = null) : string
40 {
41 $url = $this->getURL($command, $param);
42 return $url->getBaseURI() . '?' . $url->getQuery();
43 }
44}
An exception for terminatinating execution or to throw for unit testing.
Class LSUrlBuilder.
const PARAM_LSO_COMMAND
getURL(string $command, int $param=null)
Get an URL for the provided command and params.
getHref(string $command, int $param=null)
__construct(ILIAS\Data\URI $base_url)
const PARAM_LSO_PARAMETER
The URLBuilder allows views to get links that are used somewhere inline in the content.
Definition: URLBuilder.php:13
Class ChatMainBarProvider \MainMenu\Provider.
$query
$url
$param
Definition: xapitoken.php:31