Skip to content

Commit 5e8583a

Browse files
committed
Fix extending
1 parent 50149cf commit 5e8583a

File tree

3 files changed

+145
-9
lines changed

3 files changed

+145
-9
lines changed

src/Html/Uri.php

+36-9
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ public function __construct($uri)
8686
$this->setFragment(Arrays::value($parts, 'fragment', ''));
8787
}
8888

89-
public function __toString(): string
89+
/**
90+
* @return string
91+
*/
92+
public function __toString()
9093
{
9194
$prefix = null;
9295
if($this->protocol || $this->domain || $this->port)
@@ -140,7 +143,10 @@ public function __toString(): string
140143
return $prefix . $this->getPath() . $query . $fragment;
141144
}
142145

143-
public function getFragment(): string
146+
/**
147+
* @return string
148+
*/
149+
public function getFragment()
144150
{
145151
return $this->fragment;
146152
}
@@ -154,7 +160,10 @@ public function setFragment($fragment)
154160
return $this;
155161
}
156162

157-
public function getPath(): string
163+
/**
164+
* @return string
165+
*/
166+
public function getPath()
158167
{
159168
return $this->path;
160169
}
@@ -197,12 +206,18 @@ public function setQueryParams(array $params)
197206
return $this;
198207
}
199208

200-
public function getQueryParams(): array
209+
/**
210+
* @return array
211+
*/
212+
public function getQueryParams()
201213
{
202214
return $this->query;
203215
}
204216

205-
public function getProtocol(): string
217+
/**
218+
* @return string
219+
*/
220+
public function getProtocol()
206221
{
207222
return $this->protocol;
208223
}
@@ -216,7 +231,10 @@ public function setProtocol($protocol)
216231
return $this;
217232
}
218233

219-
public function getDomain(): string
234+
/**
235+
* @return string
236+
*/
237+
public function getDomain()
220238
{
221239
return $this->domain;
222240
}
@@ -230,7 +248,10 @@ public function setDomain($domain)
230248
return $this;
231249
}
232250

233-
public function getPort(): string
251+
/**
252+
* @return string
253+
*/
254+
public function getPort()
234255
{
235256
return $this->port;
236257
}
@@ -269,7 +290,10 @@ public function appendPath(string $path)
269290
return $this;
270291
}
271292

272-
public function getUser(): string
293+
/**
294+
* @return string
295+
*/
296+
public function getUser()
273297
{
274298
return $this->user;
275299
}
@@ -283,7 +307,10 @@ public function setUser(string $user)
283307
return $this;
284308
}
285309

286-
public function getPass(): string
310+
/**
311+
* @return string
312+
*/
313+
public function getPass()
287314
{
288315
return $this->pass;
289316
}

tests/Html/HtmlElementTest.php

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use Packaged\SafeHtml\SafeHtml;
55
use Packaged\Ui\Html\Uri;
66
use Packaged\Ui\Tests\Supporting\Html\TestExtendingHtmlElement;
7+
use Packaged\Ui\Tests\Supporting\Html\TestExtendingUri;
78
use Packaged\Ui\Tests\Supporting\Html\TestHtmlElement;
89
use PHPUnit\Framework\TestCase;
910

@@ -269,5 +270,8 @@ public function testExtending()
269270
{
270271
$ele = new TestExtendingHtmlElement();
271272
self::assertInstanceOf(TestExtendingHtmlElement::class, $ele);
273+
274+
$ele = new TestExtendingUri('test');
275+
self::assertInstanceOf(TestExtendingUri::class, $ele);
272276
}
273277
}
+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?php
2+
3+
namespace Packaged\Ui\Tests\Supporting\Html;
4+
5+
use Packaged\Ui\Html\Uri;
6+
7+
class TestExtendingUri extends Uri
8+
{
9+
public function __construct($uri) { parent::__construct($uri); }
10+
11+
public function __toString()
12+
{
13+
return parent::__toString();
14+
}
15+
16+
public function getFragment()
17+
{
18+
return parent::getFragment();
19+
}
20+
21+
public function setFragment($fragment)
22+
{
23+
return parent::setFragment($fragment);
24+
}
25+
26+
public function getPath()
27+
{
28+
return parent::getPath();
29+
}
30+
31+
public function setPath($path)
32+
{
33+
return parent::setPath($path);
34+
}
35+
36+
public function setQueryParam($key, $value)
37+
{
38+
return parent::setQueryParam($key, $value);
39+
}
40+
41+
public function setQueryParams(array $params)
42+
{
43+
return parent::setQueryParams($params);
44+
}
45+
46+
public function getQueryParams()
47+
{
48+
return parent::getQueryParams();
49+
}
50+
51+
public function getProtocol()
52+
{
53+
return parent::getProtocol();
54+
}
55+
56+
public function setProtocol($protocol)
57+
{
58+
return parent::setProtocol($protocol);
59+
}
60+
61+
public function getDomain()
62+
{
63+
return parent::getDomain();
64+
}
65+
66+
public function setDomain($domain)
67+
{
68+
return parent::setDomain($domain);
69+
}
70+
71+
public function getPort()
72+
{
73+
return parent::getPort();
74+
}
75+
76+
public function setPort($port)
77+
{
78+
return parent::setPort($port);
79+
}
80+
81+
public function appendPath($path)
82+
{
83+
return parent::appendPath($path);
84+
}
85+
86+
public function getUser()
87+
{
88+
return parent::getUser();
89+
}
90+
91+
public function setUser($user)
92+
{
93+
return parent::setUser($user);
94+
}
95+
96+
public function getPass()
97+
{
98+
return parent::getPass();
99+
}
100+
101+
public function setPass($pass)
102+
{
103+
return parent::setPass($pass);
104+
}
105+
}

0 commit comments

Comments
 (0)