@@ 14-29 (lines=16) @@ | ||
11 | * |
|
12 | * @author David de Boer <[email protected]> |
|
13 | */ |
|
14 | final class DiactorosUriFactory implements UriFactory |
|
15 | { |
|
16 | /** |
|
17 | * {@inheritdoc} |
|
18 | */ |
|
19 | public function createUri($uri) |
|
20 | { |
|
21 | if ($uri instanceof UriInterface) { |
|
22 | return $uri; |
|
23 | } elseif (is_string($uri)) { |
|
24 | return new Uri($uri); |
|
25 | } |
|
26 | ||
27 | throw new \InvalidArgumentException('URI must be a string or UriInterface'); |
|
28 | } |
|
29 | } |
|
30 |
@@ 14-31 (lines=18) @@ | ||
11 | * |
|
12 | * @author Mika Tuupola <[email protected]> |
|
13 | */ |
|
14 | final class SlimUriFactory implements UriFactory |
|
15 | { |
|
16 | /** |
|
17 | * {@inheritdoc} |
|
18 | */ |
|
19 | public function createUri($uri) |
|
20 | { |
|
21 | if ($uri instanceof UriInterface) { |
|
22 | return $uri; |
|
23 | } |
|
24 | ||
25 | if (is_string($uri)) { |
|
26 | return Uri::createFromString($uri); |
|
27 | } |
|
28 | ||
29 | throw new \InvalidArgumentException('URI must be a string or UriInterface'); |
|
30 | } |
|
31 | } |
|
32 |