2024-05-07 12:17:25 +02:00
|
|
|
<?php
|
|
|
|
|
|
2024-08-13 13:44:16 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2024-05-07 12:17:25 +02:00
|
|
|
/*
|
|
|
|
|
* This file is part of the league/commonmark package.
|
|
|
|
|
*
|
|
|
|
|
* (c) Colin O'Dell <colinodell@gmail.com>
|
|
|
|
|
*
|
|
|
|
|
* Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
|
|
|
|
|
* - (c) John MacFarlane
|
|
|
|
|
*
|
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace League\CommonMark\Util;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Utility class for handling/generating XML and HTML
|
2024-08-13 13:44:16 +00:00
|
|
|
*
|
|
|
|
|
* @psalm-immutable
|
2024-05-07 12:17:25 +02:00
|
|
|
*/
|
|
|
|
|
final class Xml
|
|
|
|
|
{
|
|
|
|
|
/**
|
2024-08-13 13:44:16 +00:00
|
|
|
* @psalm-pure
|
2024-05-07 12:17:25 +02:00
|
|
|
*/
|
2024-08-13 13:44:16 +00:00
|
|
|
public static function escape(string $string): string
|
2024-05-07 12:17:25 +02:00
|
|
|
{
|
|
|
|
|
return \str_replace(['&', '<', '>', '"'], ['&', '<', '>', '"'], $string);
|
|
|
|
|
}
|
|
|
|
|
}
|