Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php declare(strict_types = 1);
2
namespace TheSeer\Tokenizer;
3
 
4
class NamespaceUri {
5
 
6
    /** @var string */
7
    private $value;
8
 
9
    public function __construct(string $value) {
10
        $this->ensureValidUri($value);
11
        $this->value = $value;
12
    }
13
 
14
    public function asString(): string {
15
        return $this->value;
16
    }
17
 
18
    private function ensureValidUri($value): void {
19
        if (\strpos($value, ':') === false) {
20
            throw new NamespaceUriException(
21
                \sprintf("Namespace URI '%s' must contain at least one colon", $value)
22
            );
23
        }
24
    }
25
}