blob: 14e9f0c8ca92944e1ca7e504939caa66d9572e5e (
plain)
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
|
<?php declare(strict_types = 1);
namespace TheSeer\Tokenizer;
class NamespaceUri {
/** @var string */
private $value;
public function __construct(string $value) {
$this->ensureValidUri($value);
$this->value = $value;
}
public function asString(): string {
return $this->value;
}
private function ensureValidUri($value): void {
if (\strpos($value, ':') === false) {
throw new NamespaceUriException(
\sprintf("Namespace URI '%s' must contain at least one colon", $value)
);
}
}
}
|