-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXml.php
39 lines (32 loc) · 986 Bytes
/
Xml.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
declare(strict_types=1);
/*
* This file is part of the QuidPHP package <https://quidphp.com>
* Author: Pierre-Philippe Emond <emondpph@gmail.com>
* License: https://github.com/quidphp/base/blob/master/LICENSE
*/
namespace Quid\Base;
// xml
// class with some static methods related to XML
final class Xml extends Root
{
// config
protected static array $config = [
'urlset'=>[ // défini les urlset utilisés par xml
'sitemap'=>"<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'></urlset>"]
];
// is
// retourne vrai si la valeur est xml
final public static function is(mixed $value):bool
{
return is_string($value) && Str::isStart('<?xml',$value);
}
// urlset
// retourne un urlset, tel que paramétré dans config
// si inexistant retourne la string
final public static function urlset(string $value):?string
{
return self::$config['urlset'][$value] ?? null;
}
}
?>