1 | <?php |
||
22 | abstract class AbstractLocationTransformer implements |
||
23 | LocationTransformerInterface |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * @var ServerRequestInterface |
||
28 | */ |
||
29 | protected $request; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $options = [ |
||
35 | 'query' => [], |
||
36 | 'reuseHostName' => false, |
||
37 | 'reuseParams' => false |
||
38 | ]; |
||
39 | |||
40 | /** |
||
41 | * Set the context HTTP request |
||
42 | * |
||
43 | * @param ServerRequestInterface $request |
||
44 | * |
||
45 | * @return BasePathTransformer|LocationTransformerInterface |
||
46 | */ |
||
47 | public function setRequest(ServerRequestInterface $request) |
||
52 | |||
53 | /** |
||
54 | * Tries to transform the provided location data into a server URI |
||
55 | * |
||
56 | * @param string $location Location name, path or identifier |
||
57 | * @param array $options Filter options |
||
58 | * |
||
59 | * @return UriInterface|null |
||
60 | */ |
||
61 | abstract public function transform($location, array $options = []); |
||
62 | |||
63 | /** |
||
64 | * Updates the URI according to existing options |
||
65 | * |
||
66 | * @param UriInterface $uri |
||
67 | * |
||
68 | * @return UriInterface |
||
69 | */ |
||
70 | protected function updateOptions(UriInterface $uri) |
||
83 | |||
84 | /** |
||
85 | * Adds the scheme, host name and port to the provided URI |
||
86 | * |
||
87 | * @param UriInterface $uri |
||
88 | * |
||
89 | * @return UriInterface |
||
90 | */ |
||
91 | private function updateHostName(UriInterface $uri) |
||
114 | } |
||
115 |