ILIAS  release_7 Revision v7.30-3-g800a261c036
StringTransformation.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8namespace ILIAS\Refinery\URI;
9
15
17{
20
24 public function transform($from)
25 {
26 if (false === $from instanceof URI) {
28 sprintf('The value MUST be of type "%s"', URI::class),
29 'not_uri_object'
30 );
31 }
32
34 $result = $from->getBaseURI();
35
36 $query = $from->getQuery();
37 if (null !== $query) {
38 $query = '?' . $query;
39 }
40 $result .= $query;
41
42 $fragment = $from->getFragment();
43 if (null !== $fragment) {
44 $fragment = '#' . $fragment;
45 }
47
48 return $result;
49 }
50}
$result
An exception for terminatinating execution or to throw for unit testing.
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:18
A transformation is a function from one datatype to another.
transform($from)
Perform the transformation.