Skip to content

Commit 07e45fc

Browse files
author
Martin Brecht-Precht
committed
Extracted the UrlInterface
1 parent 7519046 commit 07e45fc

File tree

2 files changed

+199
-1
lines changed

2 files changed

+199
-1
lines changed

Diff for: src/Url.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* @package Url
99
*/
10-
class Url
10+
class Url implements UrlInterface
1111
{
1212

1313
const URL_SCHEME_SEPARATOR = '://';

Diff for: src/UrlInterface.php

+198
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
<?php
2+
3+
namespace Url;
4+
5+
/**
6+
* Interface UrlInterface
7+
*
8+
* @package Url
9+
*/
10+
interface UrlInterface
11+
{
12+
13+
/**
14+
* Url constructor.
15+
*
16+
* @param string $url
17+
*/
18+
public function __construct($url = null);
19+
20+
/**
21+
* @param string $url
22+
* @return $this
23+
*/
24+
public function parseUrl($url);
25+
26+
/**
27+
* @param string $queryString
28+
* @return $this
29+
*/
30+
public function parseQueryString($queryString);
31+
32+
/**
33+
* @return string
34+
*/
35+
public function buildUrl();
36+
37+
/**
38+
* @return string
39+
*/
40+
public function buildQueryString();
41+
42+
/**
43+
* @return string
44+
*/
45+
public function getScheme();
46+
47+
/**
48+
* @return bool
49+
*/
50+
public function hasScheme();
51+
52+
/**
53+
* @param string $scheme
54+
* @return $this
55+
*/
56+
public function setScheme($scheme);
57+
58+
/**
59+
* @return string
60+
*/
61+
public function getHostname();
62+
63+
/**
64+
* @return bool
65+
*/
66+
public function hasHostname();
67+
68+
/**
69+
* @param string $hostname
70+
* @return $this
71+
*/
72+
public function setHostname($hostname);
73+
74+
/**
75+
* @return int
76+
*/
77+
public function getPort();
78+
79+
/**
80+
* @return bool
81+
*/
82+
public function hasPort();
83+
84+
/**
85+
* @param int $port
86+
* @return $this
87+
*/
88+
public function setPort($port);
89+
90+
/**
91+
* @return string
92+
*/
93+
public function getPath();
94+
95+
/**
96+
* @return bool
97+
*/
98+
public function hasPath();
99+
100+
/**
101+
* @param string $path
102+
* @return $this
103+
*/
104+
public function setPath($path);
105+
106+
/**
107+
* @return QueryParameterInterface[]
108+
*/
109+
public function getQueryParameters();
110+
111+
/**
112+
* @return bool
113+
*/
114+
public function hasQueryParameters();
115+
116+
/**
117+
* @return int
118+
*/
119+
public function countQueryParameters();
120+
121+
/**
122+
* @param QueryParameterInterface[] $queryParameters
123+
* @return $this
124+
*/
125+
public function setQueryParameters($queryParameters);
126+
127+
/**
128+
* @param QueryParameterInterface $queryParameter
129+
* @return $this
130+
*/
131+
public function addQueryParameter(QueryParameterInterface $queryParameter);
132+
133+
/**
134+
* @param QueryParameterInterface $queryParameter
135+
* @return $this
136+
*/
137+
public function removeQueryParameter(QueryParameterInterface $queryParameter);
138+
139+
/**
140+
* @param string $key
141+
* @return $this
142+
*/
143+
public function removeQueryParameterByKey($key);
144+
145+
/**
146+
* @return $this
147+
*/
148+
public function clearQueryParameters();
149+
150+
/**
151+
* @return string
152+
*/
153+
public function getUsername();
154+
155+
/**
156+
* @return bool
157+
*/
158+
public function hasUsername();
159+
160+
/**
161+
* @param string $username
162+
* @return $this
163+
*/
164+
public function setUsername($username);
165+
166+
/**
167+
* @return string
168+
*/
169+
public function getPassword();
170+
171+
/**
172+
* @return bool
173+
*/
174+
public function hasPassword();
175+
176+
/**
177+
* @param string $password
178+
* @return $this
179+
*/
180+
public function setPassword($password);
181+
182+
/**
183+
* @return string
184+
*/
185+
public function getFragment();
186+
187+
/**
188+
* @return bool
189+
*/
190+
public function hasFragment();
191+
192+
/**
193+
* @param string $fragment
194+
* @return $this
195+
*/
196+
public function setFragment($fragment);
197+
198+
}

0 commit comments

Comments
 (0)