Total Complexity | 6 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class Scheme |
||
6 | { |
||
7 | public const HTTP = 'http'; |
||
8 | public const HTTPS = 'https'; |
||
9 | |||
10 | /** @var string */ |
||
11 | private $scheme; |
||
12 | |||
13 | public function __construct(string $scheme) |
||
14 | { |
||
15 | $this->ensureIsValidScheme($scheme); |
||
16 | $this->scheme = $scheme; |
||
17 | } |
||
18 | |||
19 | public static function createHttp(): self |
||
20 | { |
||
21 | return new self(self::HTTP); |
||
22 | } |
||
23 | |||
24 | public static function createHttps(): self |
||
25 | { |
||
26 | return new self(self::HTTPS); |
||
27 | } |
||
28 | |||
29 | public function asString(): string |
||
32 | } |
||
33 | |||
34 | private function ensureIsValidScheme($scheme) |
||
38 | } |
||
39 | } |
||
40 | } |
||
41 |