ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
URL.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26use ValueError;
27
35class URL implements Transformation
36{
39
40 public function transform($from)
41 {
42 if (false === preg_match('//u', $from)) {
43 throw new ValueError('Invalid UTF-8 string given.');
44 }
45 return rawurlencode($from);
46 }
47}
Inspired by: Laminas escaper: https://github.com/laminas/laminas-escaper.
Definition: URL.php:36
transform($from)
Perform the transformation.
Definition: URL.php:40
A transformation is a function from one datatype to another.