| Total Complexity | 4 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 19 | final class DomainHint extends AbstractMduiElement |
||
| 20 | { |
||
| 21 | use StringElementTrait; |
||
| 22 | |||
| 23 | |||
| 24 | /** |
||
| 25 | * @param string $content |
||
| 26 | */ |
||
| 27 | public function __construct(string $content) |
||
| 30 | } |
||
| 31 | |||
| 32 | |||
| 33 | /** |
||
| 34 | * Sanitize the content of the element. |
||
| 35 | * |
||
| 36 | * @param string $content The unsanitized textContent |
||
| 37 | * @throws \Exception on failure |
||
| 38 | * @return string |
||
| 39 | */ |
||
| 40 | protected function sanitizeContent(string $content): string |
||
| 41 | { |
||
| 42 | // Remove prefixed schema and/or trailing whitespace + forward slashes |
||
| 43 | return trimr(preg_replace('#^http[s]?://#i', '', $content), " \n\r\t\v\x00/"); |
||
|
|
|||
| 44 | } |
||
| 45 | |||
| 46 | |||
| 47 | /** |
||
| 48 | * Validate the content of the element. |
||
| 49 | * |
||
| 50 | * @param string $content The value to go in the XML textContent |
||
| 51 | * @throws \Exception on failure |
||
| 52 | * @return void |
||
| 53 | */ |
||
| 54 | protected function validateContent(string $content): void |
||
| 59 | } |
||
| 60 | } |
||
| 62 |