Skip to content

Commit 49c45bc

Browse files
committed
Remove setters, update tests.
1 parent d1bca89 commit 49c45bc

File tree

4 files changed

+15
-100
lines changed

4 files changed

+15
-100
lines changed

src/Pdp/Uri/Url.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,17 @@ public function __toString()
156156
public function toArray()
157157
{
158158
return array(
159-
'scheme' => $this->scheme,
160-
'user' => $this->user,
161-
'pass' => $this->pass,
162-
'host' => $this->host->__toString(),
163-
'subdomain' => $this->host->getSubdomain(),
164-
'registrableDomain' => $this->host->getRegistrableDomain(),
165-
'publicSuffix' => $this->host->getPublicSuffix(),
166-
'port' => $this->port,
167-
'path' => $this->path,
168-
'query' => $this->query,
169-
'fragment' => $this->fragment,
159+
'scheme' => $this->getScheme(),
160+
'user' => $this->getUser(),
161+
'pass' => $this->getPass(),
162+
'host' => $this->getHost()->__toString(),
163+
'subdomain' => $this->getHost()->getSubdomain(),
164+
'registrableDomain' => $this->getHost()->getRegistrableDomain(),
165+
'publicSuffix' => $this->getHost()->getPublicSuffix(),
166+
'port' => $this->getPort(),
167+
'path' => $this->getPath(),
168+
'query' => $this->getQuery(),
169+
'fragment' => $this->getFragment(),
170170
);
171171
}
172172

src/Pdp/Uri/Url/Host.php

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,6 @@ public function getSubdomain()
6161
return $this->subdomain;
6262
}
6363

64-
/**
65-
* @param string $subdomain
66-
*/
67-
public function setSubdomain($subdomain)
68-
{
69-
$this->subdomain = $subdomain;
70-
}
71-
7264
/**
7365
* @return string
7466
*/
@@ -77,14 +69,6 @@ public function getRegistrableDomain()
7769
return $this->registrableDomain;
7870
}
7971

80-
/**
81-
* @param string $registrableDomain
82-
*/
83-
public function setRegistrableDomain($registrableDomain)
84-
{
85-
$this->registrableDomain = $registrableDomain;
86-
}
87-
8872
/**
8973
* Get Public suffix.
9074
*
@@ -95,14 +79,6 @@ public function getPublicSuffix()
9579
return $this->publicSuffix;
9680
}
9781

98-
/**
99-
* @param string $publicSuffix
100-
*/
101-
public function setPublicSuffix($publicSuffix)
102-
{
103-
$this->publicSuffix = $publicSuffix;
104-
}
105-
10682
/**
10783
* Get Entire host part.
10884
*
@@ -113,14 +89,6 @@ public function getHost()
11389
return $this->host;
11490
}
11591

116-
/**
117-
* @param string $host
118-
*/
119-
public function setHost($host)
120-
{
121-
$this->host = $host;
122-
}
123-
12492
/**
12593
* Get string representation of host.
12694
*
@@ -149,10 +117,10 @@ public function __toString()
149117
public function toArray()
150118
{
151119
return array(
152-
'subdomain' => $this->subdomain,
153-
'registrableDomain' => $this->registrableDomain,
154-
'publicSuffix' => $this->publicSuffix,
155-
'host' => $this->host,
120+
'subdomain' => $this->getSubdomain(),
121+
'registrableDomain' => $this->getRegistrableDomain(),
122+
'publicSuffix' => $this->getPublicSuffix(),
123+
'host' => $this->getHost(),
156124
);
157125
}
158126
}

tests/src/Pdp/Uri/Url/HostTest.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,36 +35,6 @@ public function test__toStringWhenHostPartIsNull()
3535
$this->assertEquals('www.example.com', $host->__toString());
3636
}
3737

38-
/**
39-
* @dataProvider hostDataProvider
40-
*
41-
* @param $publicSuffix
42-
* @param $registrableDomain
43-
* @param $subdomain
44-
* @param $hostPart
45-
*/
46-
public function test__get($publicSuffix, $registrableDomain, $subdomain, $hostPart)
47-
{
48-
$parts = array(
49-
'subdomain' => $subdomain,
50-
'registrableDomain' => $registrableDomain,
51-
'publicSuffix' => $publicSuffix,
52-
'host' => $hostPart,
53-
);
54-
55-
$host = new Host(
56-
$parts['subdomain'],
57-
$parts['registrableDomain'],
58-
$parts['publicSuffix'],
59-
$parts['host']
60-
);
61-
62-
$this->assertSame($hostPart, $host->getHost());
63-
$this->assertSame($parts['subdomain'], $host->getSubdomain());
64-
$this->assertEquals($parts['registrableDomain'], $host->getRegistrableDomain());
65-
$this->assertEquals($parts['publicSuffix'], $host->getPublicSuffix());
66-
}
67-
6838
/**
6939
* @dataProvider hostDataProvider
7040
*

tests/src/Pdp/Uri/UrlTest.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -74,29 +74,6 @@ public function testGetSchemeless()
7474
$this->assertEquals($schemeless, $this->url->getSchemeless());
7575
}
7676

77-
public function test__getProperties()
78-
{
79-
$expected = array(
80-
'scheme' => 'http',
81-
'user' => 'anonymous',
82-
'pass' => 'guest',
83-
'host' => 'example.com',
84-
'port' => 8080,
85-
'path' => '/path/to/index.php/foo/bar.xml',
86-
'query' => 'baz=dib',
87-
'fragment' => 'anchor',
88-
);
89-
90-
$this->assertEquals($expected['scheme'], $this->url->getScheme());
91-
$this->assertEquals($expected['user'], $this->url->getUser());
92-
$this->assertEquals($expected['pass'], $this->url->getPass());
93-
$this->assertEquals($expected['host'], $this->url->getHost()->__toString());
94-
$this->assertEquals($expected['port'], $this->url->getPort());
95-
$this->assertEquals($expected['path'], $this->url->getPath());
96-
$this->assertEquals($expected['query'], $this->url->getQuery());
97-
$this->assertEquals($expected['fragment'], $this->url->getFragment());
98-
}
99-
10077
public function testToArray()
10178
{
10279
$expected = array(

0 commit comments

Comments
 (0)