ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 
8 namespace ILIAS\Refinery\URI;
9 
10 use ILIAS\Data\URI;
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  }
46  $result .= $fragment;
47 
48  return $result;
49  }
50 }
$result
transform($from)
Perform the transformation.
The scope of this class is split ilias-conform URI&#39;s into components.
Definition: URI.php:17
A transformation is a function from one datatype to another.