| 1 | <?php |
||
| 4 | class Escape |
||
| 5 | { |
||
| 6 | /** |
||
| 7 | * @var callable |
||
| 8 | */ |
||
| 9 | private $escape = ['Tuum\Form\Data\Escape', 'htmlSafe']; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @param null|callable $escape |
||
| 13 | */ |
||
| 14 | public function __construct($escape = null) |
||
| 20 | |||
| 21 | /** |
||
| 22 | * escape for html output. |
||
| 23 | * |
||
| 24 | * @param string $string |
||
| 25 | * @return string |
||
| 26 | */ |
||
| 27 | public static function htmlSafe($string) |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @param string $string |
||
| 34 | * @return mixed |
||
| 35 | */ |
||
| 36 | public function __invoke($string) |
||
| 40 | |||
| 41 | /** |
||
| 42 | * escapes a string using $this->escape. |
||
| 43 | * |
||
| 44 | * @param string $string |
||
| 45 | * @return mixed |
||
| 46 | */ |
||
| 47 | public function escape($string) |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @return callable |
||
| 58 | */ |
||
| 59 | public function getEscape() |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param callable $escape |
||
| 68 | * @return Escape |
||
| 69 | */ |
||
| 70 | public function setEscape($escape) |
||
| 75 | |||
| 76 | } |