Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | /** |
3 | * Jingga |
4 | * |
5 | * PHP Version 8.1 |
6 | * |
7 | * @package phpOMS\Uri |
8 | * @copyright Dennis Eichhorn |
9 | * @license OMS License 2.0 |
10 | * @version 1.0.0 |
11 | * @link https://jingga.app |
12 | */ |
13 | declare(strict_types=1); |
14 | |
15 | namespace phpOMS\Uri; |
16 | |
17 | /** |
18 | * Uri interface. |
19 | * |
20 | * @property string $scheme Scheme |
21 | * @property string $host Host |
22 | * @property int $port Port |
23 | * @property string $fragment Fragment |
24 | * @property array $fragments Fragments |
25 | * @property string $user User |
26 | * @property string $pass Password |
27 | * @property string $uri Uri |
28 | * @property string $path Path |
29 | * |
30 | * @package phpOMS\Uri |
31 | * @license OMS License 2.0 |
32 | * @link https://jingga.app |
33 | * @since 1.0.0 |
34 | */ |
35 | interface UriInterface |
36 | { |
37 | /** |
38 | * Is uri valid? |
39 | * |
40 | * @param string $uri Uri string |
41 | * |
42 | * @return bool |
43 | * |
44 | * @since 1.0.0 |
45 | */ |
46 | public static function isValid(string $uri) : bool; |
47 | |
48 | /** |
49 | * Get authority. |
50 | * |
51 | * @return string |
52 | * |
53 | * @since 1.0.0 |
54 | */ |
55 | public function getAuthority() : string; |
56 | |
57 | /** |
58 | * Get user info. |
59 | * |
60 | * @return string |
61 | * |
62 | * @since 1.0.0 |
63 | */ |
64 | public function getUserInfo() : string; |
65 | |
66 | /** |
67 | * Get path. |
68 | * |
69 | * @return string |
70 | * |
71 | * @since 1.0.0 |
72 | */ |
73 | public function getPath() : string; |
74 | |
75 | /** |
76 | * Set path. |
77 | * |
78 | * @param string $path Path |
79 | * |
80 | * @return void |
81 | * |
82 | * @since 1.0.0 |
83 | */ |
84 | public function setPath(string $path) : void; |
85 | |
86 | /** |
87 | * Get root path. |
88 | * |
89 | * @return string |
90 | * |
91 | * @since 1.0.0 |
92 | */ |
93 | public function getRootPath() : string; |
94 | |
95 | /** |
96 | * Set root path. |
97 | * |
98 | * @param string $root Root path |
99 | * |
100 | * @return void |
101 | * |
102 | * @since 1.0.0 |
103 | */ |
104 | public function setRootPath(string $root) : void; |
105 | |
106 | /** |
107 | * Set path offset. |
108 | * |
109 | * This can be used if the uri path starts with elements which are not relevant later on. |
110 | * |
111 | * @param int $offset Path offset |
112 | * |
113 | * @return void |
114 | * |
115 | * @since 1.0.0 |
116 | */ |
117 | public function setPathOffset(int $offset = 0) : void; |
118 | |
119 | /** |
120 | * Get path element. |
121 | * |
122 | * @param int $pos Position of the path |
123 | * @param bool $useOffset Uses internal path offset |
124 | * |
125 | * @return string |
126 | * |
127 | * @since 1.0.0 |
128 | */ |
129 | public function getPathElement(int $pos = 0, bool $useOffset = true) : string; |
130 | |
131 | /** |
132 | * Get the value after a key |
133 | * |
134 | * @param string $key Key to search for in path |
135 | * |
136 | * @return string |
137 | * |
138 | * @since 1.0.0 |
139 | */ |
140 | public function getPathKey(string $key) : string; |
141 | |
142 | /** |
143 | * Get path elements. |
144 | * |
145 | * @return string[] |
146 | * |
147 | * @since 1.0.0 |
148 | */ |
149 | public function getPathElements() : array; |
150 | |
151 | /** |
152 | * Set query from uri. |
153 | * |
154 | * @param string $uri Uri to parse |
155 | * |
156 | * @return void |
157 | * |
158 | * @since 1.0.0 |
159 | */ |
160 | public function setQuery(string $uri) : void; |
161 | |
162 | /** |
163 | * Get query. |
164 | * |
165 | * @param string $key Query key |
166 | * |
167 | * @return string |
168 | * |
169 | * @since 1.0.0 |
170 | */ |
171 | public function getQuery(string $key = null) : string; |
172 | |
173 | /** |
174 | * Get query array. |
175 | * |
176 | * @return string[] |
177 | * |
178 | * @since 1.0.0 |
179 | */ |
180 | public function getQueryArray() : array; |
181 | |
182 | /** |
183 | * Get uri. |
184 | * |
185 | * @return string |
186 | * |
187 | * @since 1.0.0 |
188 | */ |
189 | public function __toString(); |
190 | |
191 | /** |
192 | * Get base uri. |
193 | * |
194 | * @return string |
195 | * |
196 | * @since 1.0.0 |
197 | */ |
198 | public function getBase() : string; |
199 | |
200 | /** |
201 | * Get route representation of uri. |
202 | * |
203 | * @param bool $ignoreOffset Ignore internal offset |
204 | * |
205 | * @return string |
206 | * |
207 | * @since 1.0.0 |
208 | */ |
209 | public function getRoute(bool $ignoreOffset = false) : string; |
210 | |
211 | /** |
212 | * Set uri. |
213 | * |
214 | * @param string $uri Uri |
215 | * |
216 | * @return void |
217 | * |
218 | * @since 1.0.0 |
219 | */ |
220 | public function set(string $uri) : void; |
221 | } |