* @param string $tagName the name of the tag like '!str' (WITHOUT the first "!")
21
* @param mixed $value any PHP variable type
22
* @throws \Exception if $tagName is an invalid string or absent
23
*/
24
public function __construct(string $tagName, $value)
25
{
26
if (empty($tagName)) {
27
throw new \Exception(self::class.": a tag MUST have a name", 1);
28
}
29
$this->tagName = $tagName;
30
$this->value = $value;
31
}
32
33
/**
34
* Should verify if the tag is correct
35
*
36
* @param string $providedName The provided name
37
* @todo is this required ???
38
*/
39
// private function checkNameValidity(string $providedName)
40
// {
41
/* TODO implement and throw Exception if invalid (setName method ???)
42
*The suffix must not contain any “!” character. This would cause the tag shorthand to be interpreted as having a named tag handle. In addition, the suffix must not contain the “[”, “]”, “{”, “}” and “,” characters. These characters would cause ambiguity with flow collection structures. If the suffix needs to specify any of the above restricted characters, they must be escaped using the “%” character. This behavior is consistent with the URI character escaping rules (specifically, section 2.3 of RFC2396).