Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
AttributeName.php
01 <?php
02
03 /**
04 * @package s9e\TextFormatter
05 * @copyright Copyright (c) 2010-2022 The s9e authors
06 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
07 */
08 namespace s9e\TextFormatter\Configurator\Validators;
09
10 use InvalidArgumentException;
11
12 /**
13 * Attribute name rules:
14 * - must start with a letter or an underscore
15 * - can only contain letters, numbers, underscores and dashes
16 *
17 * Unprefixed names are normalized to uppercase. Prefixed names are preserved as-is.
18 */
19 abstract class AttributeName
20 {
21 /**
22 * Return whether a string is a valid attribute name
23 *
24 * @param string $name
25 * @return bool
26 */
27 public static function isValid($name)
28 {
29 return (bool) preg_match('#^(?!xmlns$)[a-z_][-a-z_0-9]*$#Di', $name);
30 }
31
32 /**
33 * Normalize a tag name
34 *
35 * @throws InvalidArgumentException if the original name is not valid
36 *
37 * @param string $name Original name
38 * @return string Normalized name
39 */
40 public static function normalize($name)
41 {
42 if (!static::isValid($name))
43 {
44 throw new InvalidArgumentException("Invalid attribute name '" . $name . "'");
45 }
46
47 return strtolower($name);
48 }
49 }