Skip to content

Commit 57a2915

Browse files
committed
Merge pull request #365 from pyrech/fix-failing-tests
[WIP] Fix failing tests
2 parents 079a64d + 7295453 commit 57a2915

31 files changed

+2387
-2060
lines changed

src/Geocoder/Exception/ProviderNotRegistered.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class ProviderNotRegistered extends \RuntimeException implements Exception
1717
{
1818
/**
1919
* @param string $providerName
20+
* @param array $registeredProviders
2021
*/
2122
public function __construct($providerName, array $registeredProviders = [])
2223
{

src/Geocoder/Model/AddressFactory.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,19 @@ public function createFromArray(array $results)
5656
}
5757

5858
/**
59+
* @param array $data
5960
* @param string $key
61+
* @return double
6062
*/
6163
private function readDoubleValue(array $data, $key)
6264
{
6365
return (double) \igorw\get_in($data, explode('.', $key));
6466
}
6567

6668
/**
69+
* @param array $data
6770
* @param string $key
71+
* @return string
6872
*/
6973
private function readStringValue(array $data, $key)
7074
{

src/Geocoder/Model/Bounds.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,24 @@
1515
*/
1616
final class Bounds
1717
{
18+
/**
19+
* @var double
20+
*/
1821
private $south;
1922

23+
/**
24+
* @var double
25+
*/
2026
private $west;
2127

28+
/**
29+
* @var double
30+
*/
2231
private $north;
2332

33+
/**
34+
* @var double
35+
*/
2436
private $east;
2537

2638
/**
@@ -37,31 +49,61 @@ public function __construct($south, $west, $north, $east)
3749
$this->east = $east;
3850
}
3951

52+
/**
53+
* Returns the south bound.
54+
*
55+
* @return double
56+
*/
4057
public function getSouth()
4158
{
4259
return $this->south;
4360
}
4461

62+
/**
63+
* Returns the west bound.
64+
*
65+
* @return double
66+
*/
4567
public function getWest()
4668
{
4769
return $this->west;
4870
}
4971

72+
/**
73+
* Returns the north bound.
74+
*
75+
* @return double
76+
*/
5077
public function getNorth()
5178
{
5279
return $this->north;
5380
}
5481

82+
/**
83+
* Returns the east bound.
84+
*
85+
* @return double
86+
*/
5587
public function getEast()
5688
{
5789
return $this->east;
5890
}
5991

92+
/**
93+
* Returns whether or not bounds are defined
94+
*
95+
* @return bool
96+
*/
6097
public function isDefined()
6198
{
6299
return !empty($this->south) && !empty($this->east) && !empty($this->north) && !empty($this->west);
63100
}
64101

102+
/**
103+
* Returns an array with bounds.
104+
*
105+
* @return array
106+
*/
65107
public function toArray()
66108
{
67109
return [

src/Geocoder/Model/Coordinates.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@
1515
*/
1616
final class Coordinates
1717
{
18+
/**
19+
* @var double
20+
*/
1821
private $latitude;
1922

23+
/**
24+
* @var double
25+
*/
2026
private $longitude;
2127

2228
/**
@@ -29,11 +35,21 @@ public function __construct($latitude, $longitude)
2935
$this->longitude = $longitude;
3036
}
3137

38+
/**
39+
* Returns the latitude.
40+
*
41+
* @return double
42+
*/
3243
public function getLatitude()
3344
{
3445
return $this->latitude;
3546
}
3647

48+
/**
49+
* Returns the longitude.
50+
*
51+
* @return double
52+
*/
3753
public function getLongitude()
3854
{
3955
return $this->longitude;

src/Geocoder/Model/Country.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,18 @@
1515
*/
1616
final class Country
1717
{
18+
/**
19+
* @var string
20+
*/
1821
private $name;
1922

23+
/**
24+
* @var string
25+
*/
2026
private $code;
2127

2228
/**
29+
* @param string $name
2330
* @param string $code
2431
*/
2532
public function __construct($name, $code)
@@ -28,16 +35,31 @@ public function __construct($name, $code)
2835
$this->code = $code;
2936
}
3037

38+
/**
39+
* Returns the country name
40+
*
41+
* @return string
42+
*/
3143
public function getName()
3244
{
3345
return $this->name;
3446
}
3547

48+
/**
49+
* Returns the country ISO code.
50+
*
51+
* @return string
52+
*/
3653
public function getCode()
3754
{
3855
return $this->code;
3956
}
4057

58+
/**
59+
* Returns a string with the country name.
60+
*
61+
* @return array
62+
*/
4163
public function toString()
4264
{
4365
return $this->getName();

src/Geocoder/Model/County.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,18 @@
1515
*/
1616
final class County
1717
{
18+
/**
19+
* @var string
20+
*/
1821
private $name;
1922

23+
/**
24+
* @var string
25+
*/
2026
private $code;
2127

2228
/**
29+
* @param string $name
2330
* @param string $code
2431
*/
2532
public function __construct($name, $code)
@@ -28,16 +35,31 @@ public function __construct($name, $code)
2835
$this->code = $code;
2936
}
3037

38+
/**
39+
* Returns the country name
40+
*
41+
* @return string
42+
*/
3143
public function getName()
3244
{
3345
return $this->name;
3446
}
3547

48+
/**
49+
* Returns the county short name.
50+
*
51+
* @return string
52+
*/
3653
public function getCode()
3754
{
3855
return $this->code;
3956
}
4057

58+
/**
59+
* Returns a string with the county name.
60+
*
61+
* @return array
62+
*/
4163
public function toString()
4264
{
4365
return $this->getName();

src/Geocoder/Model/Region.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,18 @@
1515
*/
1616
final class Region
1717
{
18+
/**
19+
* @var string
20+
*/
1821
private $name;
1922

23+
/**
24+
* @var string
25+
*/
2026
private $code;
2127

2228
/**
29+
* @param string $name
2330
* @param string $code
2431
*/
2532
public function __construct($name, $code)
@@ -28,16 +35,31 @@ public function __construct($name, $code)
2835
$this->code = $code;
2936
}
3037

38+
/**
39+
* Returns the region name
40+
*
41+
* @return string
42+
*/
3143
public function getName()
3244
{
3345
return $this->name;
3446
}
3547

48+
/**
49+
* Returns the region short name.
50+
*
51+
* @return string
52+
*/
3653
public function getCode()
3754
{
3855
return $this->code;
3956
}
4057

58+
/**
59+
* Returns a string with the region name.
60+
*
61+
* @return array
62+
*/
4163
public function toString()
4264
{
4365
return $this->getName();

src/Geocoder/Provider/AbstractProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ protected function getLocalhostDefaults()
111111
{
112112
return [
113113
'locality' => 'localhost',
114-
'region' => 'localhost',
115114
'county' => 'localhost',
115+
'region' => 'localhost',
116116
'country' => 'localhost',
117117
];
118118
}

src/Geocoder/Provider/ArcGISOnline.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ public function reverse($latitude, $longitude)
126126

127127
return $this->returnResults([
128128
array_merge($this->getDefaults(), [
129-
'latitude' => $coordinates[0],
130-
'longitude' => $coordinates[1],
129+
'latitude' => $latitude,
130+
'longitude' => $longitude,
131131
'streetName' => $streetName,
132132
'locality' => $city,
133133
'postalCode' => $zipcode,

src/Geocoder/Provider/GeoIP2.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private function executeQuery($address)
112112
$uri = sprintf('file://geoip?%s', $address);
113113

114114
try {
115-
$result = $this->adapter
115+
$result = $this->getAdapter()
116116
->setLocale($this->locale)
117117
->getContent($uri);
118118
} catch (AddressNotFoundException $e) {

0 commit comments

Comments
 (0)