1 | <?php |
||
24 | class Scheme extends AbstractComponent implements SchemeInterface |
||
25 | { |
||
26 | /** |
||
27 | * @inheritdoc |
||
28 | */ |
||
29 | 823 | protected function validate($scheme) |
|
30 | { |
||
31 | 823 | if (null === $scheme) { |
|
32 | 324 | return $scheme; |
|
33 | } |
||
34 | |||
35 | 736 | $scheme = $this->validateString($scheme); |
|
36 | 724 | if (!preg_match(',^[a-z]([-a-z0-9+.]+)?$,i', $scheme)) { |
|
37 | 9 | throw new InvalidArgumentException(sprintf("Invalid Submitted scheme: '%s'", $scheme)); |
|
38 | } |
||
39 | |||
40 | 715 | return strtolower($scheme); |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * @inheritdoc |
||
45 | */ |
||
46 | 2 | public function __debugInfo() |
|
47 | { |
||
48 | 2 | return ['scheme' => $this->getContent()]; |
|
49 | } |
||
50 | |||
51 | /** |
||
52 | * Returns the instance string representation |
||
53 | * with its optional URI delimiters |
||
54 | * |
||
55 | * @return string |
||
56 | */ |
||
57 | 515 | public function getUriComponent() |
|
66 | } |
||
67 |