| @@ 31-36 (lines=6) @@ | ||
| 28 | public function __construct($value) |
|
| 29 | { |
|
| 30 | $filteredValue = parse_url($value, PHP_URL_PATH); |
|
| 31 | if ($filteredValue === null || strlen($filteredValue) != strlen($value)) { |
|
| 32 | throw new \InvalidArgumentException(sprintf( |
|
| 33 | 'Argument "%s" is invalid. Allowed types for argument are "url path".', |
|
| 34 | $value |
|
| 35 | )); |
|
| 36 | } |
|
| 37 | ||
| 38 | parent::__construct($filteredValue); |
|
| 39 | } |
|
| @@ 157-162 (lines=6) @@ | ||
| 154 | { |
|
| 155 | $path = \parse_url($url, PHP_URL_PATH); |
|
| 156 | $filteredValue = parse_url($path, PHP_URL_PATH); |
|
| 157 | if ($filteredValue === null || strlen($filteredValue) != strlen($path)) { |
|
| 158 | throw new \InvalidArgumentException(sprintf( |
|
| 159 | 'Argument "%s" is invalid. Allowed types for argument are "url".', |
|
| 160 | $url |
|
| 161 | )); |
|
| 162 | } |
|
| 163 | ||
| 164 | return new Path($filteredValue); |
|
| 165 | } |
|