Test Failed
Pull Request — master (#5)
by
unknown
07:15
created
src/Object/Geometry.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -26,27 +26,27 @@
 block discarded – undo
26 26
 class Geometry extends AbstractObject
27 27
 {
28 28
 
29
-	/**
30
-	 * @var Location
31
-	 */
32
-	protected $location = null;
29
+    /**
30
+     * @var Location
31
+     */
32
+    protected $location = null;
33 33
 
34
-	/**
35
-	 * @var Viewport
36
-	 */
37
-	protected $viewport = null;
34
+    /**
35
+     * @var Viewport
36
+     */
37
+    protected $viewport = null;
38 38
 
39
-	/**
40
-	 * @var string
41
-	 */
42
-	protected $location_type = null;
39
+    /**
40
+     * @var string
41
+     */
42
+    protected $location_type = null;
43 43
 
44
-	/**
45
-	 * @var array
46
-	 */
47
-	protected $typeCheck = [
48
-		GeometryFields::LOCATION      => Location::class,
49
-		GeometryFields::VIEWPORT      => Viewport::class,
50
-		GeometryFields::LOCATION_TYPE => 'string'
51
-	];
44
+    /**
45
+     * @var array
46
+     */
47
+    protected $typeCheck = [
48
+        GeometryFields::LOCATION      => Location::class,
49
+        GeometryFields::VIEWPORT      => Viewport::class,
50
+        GeometryFields::LOCATION_TYPE => 'string'
51
+    ];
52 52
 }
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
src/Object/LatLng.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -22,56 +22,56 @@
 block discarded – undo
22 22
 class LatLng extends AbstractObject
23 23
 {
24 24
 
25
-	/**
26
-	 * @var float
27
-	 */
28
-	protected $lat = 0;
25
+    /**
26
+     * @var float
27
+     */
28
+    protected $lat = 0;
29 29
 
30
-	/**
31
-	 * @var float
32
-	 */
33
-	protected $lng = 0;
30
+    /**
31
+     * @var float
32
+     */
33
+    protected $lng = 0;
34 34
 
35
-	/**
36
-	 * @var array
37
-	 */
38
-	protected $typeCheck = [
39
-		LatLngFields::LAT => 'float',
40
-		LatLngFields::LNG => 'float',
41
-	];
35
+    /**
36
+     * @var array
37
+     */
38
+    protected $typeCheck = [
39
+        LatLngFields::LAT => 'float',
40
+        LatLngFields::LNG => 'float',
41
+    ];
42 42
 
43
-	/**
44
-	 * @return string
45
-	 */
46
-	public function __toString(): string
47
-	{
43
+    /**
44
+     * @return string
45
+     */
46
+    public function __toString(): string
47
+    {
48 48
 
49
-		return implode(',', [
50
-			$this->getLat(),
51
-			$this->getLng()
52
-		]);
53
-	}
49
+        return implode(',', [
50
+            $this->getLat(),
51
+            $this->getLng()
52
+        ]);
53
+    }
54 54
 
55
-	/**
56
-	 * Return the latitude, 0 if null
57
-	 *
58
-	 * @return string
59
-	 */
60
-	public function getLat(): string
61
-	{
55
+    /**
56
+     * Return the latitude, 0 if null
57
+     *
58
+     * @return string
59
+     */
60
+    public function getLat(): string
61
+    {
62 62
 
63
-		return $this->lat ?? 0;
64
-	}
63
+        return $this->lat ?? 0;
64
+    }
65 65
 
66
-	/**
67
-	 * Return the longitude, 0 if null
68
-	 *
69
-	 * @return string
70
-	 */
71
-	public function getLng(): string
72
-	{
66
+    /**
67
+     * Return the longitude, 0 if null
68
+     *
69
+     * @return string
70
+     */
71
+    public function getLng(): string
72
+    {
73 73
 
74
-		return $this->lng ?? 0;
75
-	}
74
+        return $this->lng ?? 0;
75
+    }
76 76
 
77 77
 }
78 78
\ No newline at end of file
Please login to merge, or discard this patch.
src/Object/PhotoCollection.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,19 +19,19 @@
 block discarded – undo
19 19
 class PhotoCollection extends AbstractCollection
20 20
 {
21 21
 
22
-	/**
23
-	 * @var string
24
-	 */
25
-	protected $item_class = Photo::class;
22
+    /**
23
+     * @var string
24
+     */
25
+    protected $item_class = Photo::class;
26 26
 
27
-	/**
28
-	 * @param $item
29
-	 *
30
-	 * @return Photo
31
-	 */
32
-	protected function parseItem($item): Photo
33
-	{
27
+    /**
28
+     * @param $item
29
+     *
30
+     * @return Photo
31
+     */
32
+    protected function parseItem($item): Photo
33
+    {
34 34
 
35
-		return ($item instanceof $this->item_class) ? $item : new $this->item_class($item);
36
-	}
35
+        return ($item instanceof $this->item_class) ? $item : new $this->item_class($item);
36
+    }
37 37
 }
38 38
\ No newline at end of file
Please login to merge, or discard this patch.
src/Object/LatLngBounds.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,22 +22,22 @@
 block discarded – undo
22 22
 class LatLngBounds extends AbstractObject
23 23
 {
24 24
 
25
-	/**
26
-	 * @var LatLng
27
-	 */
28
-	protected $northeast = null;
25
+    /**
26
+     * @var LatLng
27
+     */
28
+    protected $northeast = null;
29 29
 
30
-	/**
31
-	 * @var LatLng
32
-	 */
33
-	protected $southwest = null;
30
+    /**
31
+     * @var LatLng
32
+     */
33
+    protected $southwest = null;
34 34
 
35
-	/**
36
-	 * @var array
37
-	 */
38
-	protected $typeCheck = [
39
-		LatLngBoundsFields::NORTHEAST => LatLng::class,
40
-		LatLngBoundsFields::SOUTHWEST => LatLng::class
41
-	];
35
+    /**
36
+     * @var array
37
+     */
38
+    protected $typeCheck = [
39
+        LatLngBoundsFields::NORTHEAST => LatLng::class,
40
+        LatLngBoundsFields::SOUTHWEST => LatLng::class
41
+    ];
42 42
 
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
src/Object/Address.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@
 block discarded – undo
21 21
 class Address extends AbstractCollection
22 22
 {
23 23
 
24
-	/**
25
-	 * @param $item
26
-	 *
27
-	 * @return AddressComponent
28
-	 */
29
-	protected function parseItem($item)
30
-	{
24
+    /**
25
+     * @param $item
26
+     *
27
+     * @return AddressComponent
28
+     */
29
+    protected function parseItem($item)
30
+    {
31 31
 
32
-		return ($item instanceof AddressComponent) ? $item : new AddressComponent($item);
33
-	}
32
+        return ($item instanceof AddressComponent) ? $item : new AddressComponent($item);
33
+    }
34 34
 }
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
src/Object/Photo.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -16,33 +16,33 @@
 block discarded – undo
16 16
 class Photo extends AbstractObject
17 17
 {
18 18
 
19
-	/**
20
-	 * @var null|int
21
-	 */
22
-	protected $height = null;
23
-
24
-	/**
25
-	 * @var null|int
26
-	 */
27
-	protected $width = null;
28
-
29
-	/**
30
-	 * @var null|string
31
-	 */
32
-	protected $photo_reference = null;
33
-
34
-	/**
35
-	 * @var null|string
36
-	 */
37
-	protected $html_attributions = null;
38
-
39
-	/**
40
-	 * @var array
41
-	 */
42
-	protected $typeCheck = [
43
-		PhotoFields::HEIGHT            => 'int',
44
-		PhotoFields::WIDTH             => 'int',
45
-		PhotoFields::PHOTO_REFERENCE   => 'string',
46
-		PhotoFields::HTML_ATTRIBUTIONS => 'array',
47
-	];
19
+    /**
20
+     * @var null|int
21
+     */
22
+    protected $height = null;
23
+
24
+    /**
25
+     * @var null|int
26
+     */
27
+    protected $width = null;
28
+
29
+    /**
30
+     * @var null|string
31
+     */
32
+    protected $photo_reference = null;
33
+
34
+    /**
35
+     * @var null|string
36
+     */
37
+    protected $html_attributions = null;
38
+
39
+    /**
40
+     * @var array
41
+     */
42
+    protected $typeCheck = [
43
+        PhotoFields::HEIGHT            => 'int',
44
+        PhotoFields::WIDTH             => 'int',
45
+        PhotoFields::PHOTO_REFERENCE   => 'string',
46
+        PhotoFields::HTML_ATTRIBUTIONS => 'array',
47
+    ];
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
src/Object/AddressComponent.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -26,27 +26,27 @@
 block discarded – undo
26 26
 class AddressComponent extends AbstractObject
27 27
 {
28 28
 
29
-	/**
30
-	 * @var string
31
-	 */
32
-	protected $long_name = null;
29
+    /**
30
+     * @var string
31
+     */
32
+    protected $long_name = null;
33 33
 
34
-	/**
35
-	 * @var string
36
-	 */
37
-	protected $short_name = null;
34
+    /**
35
+     * @var string
36
+     */
37
+    protected $short_name = null;
38 38
 
39
-	/**
40
-	 * @var array
41
-	 */
42
-	protected $types = null;
39
+    /**
40
+     * @var array
41
+     */
42
+    protected $types = null;
43 43
 
44
-	/**
45
-	 * @var array
46
-	 */
47
-	protected $typeCheck = [
48
-		AddressComponentFields::LONG_NAME  => 'string',
49
-		AddressComponentFields::SHORT_NAME => 'string',
50
-		AddressComponentFields::TYPES      => 'array'
51
-	];
44
+    /**
45
+     * @var array
46
+     */
47
+    protected $typeCheck = [
48
+        AddressComponentFields::LONG_NAME  => 'string',
49
+        AddressComponentFields::SHORT_NAME => 'string',
50
+        AddressComponentFields::TYPES      => 'array'
51
+    ];
52 52
 }
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/Places.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		}
86 86
 
87 87
 		if (empty($params[GoogleMapsRequestFields::INPUT])) {
88
-			throw new InvalidArgumentException(GoogleMapsRequestFields::INPUT . " field is required");
88
+			throw new InvalidArgumentException(GoogleMapsRequestFields::INPUT." field is required");
89 89
 		}
90 90
 
91 91
 		return $this->makeApiCall($params, PlaceServicesEndpoints::FINDPLACEFROMTEXT);
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
 		if (!empty($params[GoogleMapsRequestFields::LOCATION])) {//-33.8670522,151.1957362
166 166
 			$location = $params[GoogleMapsRequestFields::LOCATION];
167 167
 			if (!$location instanceof Location) {
168
-				throw new InvalidArgumentException(GoogleMapsRequestFields::LOCATION . ' field must be instance of ' . Location::class . ' class');
168
+				throw new InvalidArgumentException(GoogleMapsRequestFields::LOCATION.' field must be instance of '.Location::class.' class');
169 169
 			}
170
-			$params[GoogleMapsRequestFields::LOCATION] = (string)$params[GoogleMapsRequestFields::LOCATION];
170
+			$params[GoogleMapsRequestFields::LOCATION] = (string) $params[GoogleMapsRequestFields::LOCATION];
171 171
 		} else {
172
-			throw new InvalidArgumentException(GoogleMapsResultFields::LOCATION . ' field is required');
172
+			throw new InvalidArgumentException(GoogleMapsResultFields::LOCATION.' field is required');
173 173
 		}
174 174
 
175 175
 		if (!empty($params[GoogleMapsRequestFields::RANKBY]) &&
@@ -180,20 +180,20 @@  discard block
 block discarded – undo
180 180
 				empty($params[GoogleMapsRequestFields::TYPE])) {
181 181
 //				If rankby=distance (described under Optional parameters below) is specified,
182 182
 // 				then one or more of keyword, name, or type is required.
183
-				throw new InvalidArgumentException('If ' . GoogleMapsRequestFields::RANKBY . ' is set as "' . RankByValues::DISTANCE . '" one or more of ' . GoogleMapsRequestFields::KEYWORD . ', ' . GoogleMapsRequestFields::NAME . ', ' . GoogleMapsRequestFields::TYPE . ' fields are required');
183
+				throw new InvalidArgumentException('If '.GoogleMapsRequestFields::RANKBY.' is set as "'.RankByValues::DISTANCE.'" one or more of '.GoogleMapsRequestFields::KEYWORD.', '.GoogleMapsRequestFields::NAME.', '.GoogleMapsRequestFields::TYPE.' fields are required');
184 184
 			}
185 185
 			if (!empty($params[GoogleMapsRequestFields::RADIUS])) {
186 186
 // 				Note that radius must not be included if rankby=distance (described under Optional parameters below) is specified.
187
-				throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must not be included if ' . GoogleMapsRequestFields::RANKBY . ' = ' . RankByValues::DISTANCE);
187
+				throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS.' must not be included if '.GoogleMapsRequestFields::RANKBY.' = '.RankByValues::DISTANCE);
188 188
 			}
189 189
 		} elseif (empty($params[GoogleMapsRequestFields::RADIUS])) {
190 190
 //			radius — Defines the distance (in meters) within which to return place results.
191
-			throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' field is required');
191
+			throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS.' field is required');
192 192
 		}
193 193
 
194 194
 		if (!empty($params[GoogleMapsRequestFields::RADIUS]) && floatval($params[GoogleMapsRequestFields::RADIUS]) > Config::MAX_PLACE_RADIUS_VALUE) {
195 195
 // 			The maximum allowed radius is 50 000 meters.
196
-			throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must be lower than ' . Config::MAX_PLACE_RADIUS_VALUE);
196
+			throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS.' must be lower than '.Config::MAX_PLACE_RADIUS_VALUE);
197 197
 		}
198 198
 
199 199
 		return $this->makeApiCall($params, PlaceServicesEndpoints::NEARBYSEARCH);
Please login to merge, or discard this patch.
Indentation   +222 added lines, -222 removed lines patch added patch discarded remove patch
@@ -34,233 +34,233 @@
 block discarded – undo
34 34
 class Places extends Api
35 35
 {
36 36
 
37
-	/**
38
-	 * @var string
39
-	 */
40
-	const SERVICE_ENDPOINT = 'place';
41
-
42
-	/**
43
-	 * @var string
44
-	 */
45
-	protected $result_type = PlacesResult::class;
46
-
47
-	/**
48
-	 * @var string
49
-	 */
50
-	protected $result_collection_type = PlaceResultsCollection::class;
51
-
52
-	/**
53
-	 * @param string     $query
54
-	 * @param array|null $params
55
-	 * @param array|null $fields
56
-	 *
57
-	 * @return GoogleMapsResultsCollection
58
-	 * @see https://developers.google.com/places/web-service/search#FindPlaceRequests
59
-	 */
60
-	public function findPlaceByText(
61
-		string $query,
62
-		?array $params = [],
63
-		?array $fields = []
64
-	): GoogleMapsResultsCollection {
65
-
66
-		$params = array_merge($params, [
67
-			GoogleMapsRequestFields::INPUT  => $query,
68
-			GoogleMapsRequestFields::FIELDS => implode(',', $fields)
69
-		]);
70
-
71
-		return $this->findPlace($params);
72
-
73
-	}
74
-
75
-	/**
76
-	 * Find Places requests
77
-	 *
78
-	 * @param array $params
79
-	 *        GoogleMapsRequestFields::INPUT required
80
-	 *
81
-	 * @see     https://developers.google.com/places/web-service/search#FindPlaceRequests
82
-	 * @return GoogleMapsResultsCollection
83
-	 * @throws InvalidArgumentException
84
-	 * @since   0.5.0
85
-	 */
86
-	public function findPlace(array $params): GoogleMapsResultsCollection
87
-	{
88
-
89
-		// see \Biscolab\GoogleMaps\Values\PlaceInputTypeValues
90
-		if (empty($params[GoogleMapsRequestFields::INPUTTYPE])) {
91
-			$params[GoogleMapsRequestFields::INPUTTYPE] = PlaceInputTypeValues::TEXTQUERY;
92
-		}
93
-
94
-		if (empty($params[GoogleMapsRequestFields::INPUT])) {
95
-			throw new InvalidArgumentException(GoogleMapsRequestFields::INPUT . " field is required");
96
-		}
97
-
98
-		return $this->makeApiCall($params, PlaceServicesEndpoints::FINDPLACEFROMTEXT);
99
-	}
100
-
101
-	/**
102
-	 * @param array  $params
103
-	 * @param string $endpoint
104
-	 *
105
-	 * @return GoogleMapsResult|GoogleMapsResultsCollection
106
-	 * @since   0.5.0
107
-	 */
108
-	public function makeApiCall(array $params, string $endpoint)
109
-	{
110
-
111
-		return $this->callApi($params, $endpoint);
112
-	}
113
-
114
-	/**
115
-	 * @param string     $number
116
-	 * @param array|null $params
117
-	 * @param array|null $fields
118
-	 *
119
-	 * @return GoogleMapsResultsCollection
120
-	 */
121
-	public function findPlaceByPhoneNumber(
122
-		string $number,
123
-		?array $params = [],
124
-		?array $fields = []
125
-	): GoogleMapsResultsCollection {
126
-
127
-		$params = array_merge($params, [
128
-			GoogleMapsRequestFields::INPUT     => $number,
129
-			GoogleMapsRequestFields::INPUTTYPE => PlaceInputTypeValues::PHONENUMBER,
130
-			GoogleMapsRequestFields::FIELDS    => implode(',', $fields)
131
-		]);
132
-
133
-		return $this->findPlace($params);
134
-
135
-	}
136
-
137
-	/**
138
-	 * @param Location   $location
139
-	 * @param int        $radius
140
-	 * @param array|null $params
141
-	 *
142
-	 * @return GoogleMapsResultsCollection
143
-	 */
144
-	public function findNearbyPlaceByRadius(
145
-		Location $location,
146
-		int $radius,
147
-		?array $params = []
148
-	): GoogleMapsResultsCollection {
149
-
150
-		$params = array_merge($params, [
151
-			GoogleMapsRequestFields::LOCATION => $location,
152
-			GoogleMapsRequestFields::RADIUS   => $radius
153
-		]);
154
-
155
-		return $this->findNearbyPlace($params);
156
-	}
157
-
158
-	/**
159
-	 * Nearby Search requests
160
-	 *
161
-	 * @param array $params
162
-	 *
163
-	 * @return GoogleMapsResultsCollection
164
-	 *
165
-	 * @throws InvalidArgumentException
166
-	 * @see     https://developers.google.com/places/web-service/search#PlaceSearchRequests
167
-	 * @since   0.5.0
168
-	 */
169
-	public function findNearbyPlace(array $params): GoogleMapsResultsCollection
170
-	{
171
-
172
-		if (!empty($params[GoogleMapsRequestFields::LOCATION])) {//-33.8670522,151.1957362
173
-			$location = $params[GoogleMapsRequestFields::LOCATION];
174
-			if (!$location instanceof Location) {
175
-				throw new InvalidArgumentException(GoogleMapsRequestFields::LOCATION . ' field must be instance of ' . Location::class . ' class');
176
-			}
177
-			$params[GoogleMapsRequestFields::LOCATION] = (string)$params[GoogleMapsRequestFields::LOCATION];
178
-		} else {
179
-			throw new InvalidArgumentException(GoogleMapsResultFields::LOCATION . ' field is required');
180
-		}
181
-
182
-		if (!empty($params[GoogleMapsRequestFields::RANKBY]) &&
183
-			$params[GoogleMapsRequestFields::RANKBY] === RankByValues::DISTANCE
184
-		) {
185
-			if (empty($params[GoogleMapsRequestFields::KEYWORD]) &&
186
-				empty($params[GoogleMapsRequestFields::NAME]) &&
187
-				empty($params[GoogleMapsRequestFields::TYPE])) {
37
+    /**
38
+     * @var string
39
+     */
40
+    const SERVICE_ENDPOINT = 'place';
41
+
42
+    /**
43
+     * @var string
44
+     */
45
+    protected $result_type = PlacesResult::class;
46
+
47
+    /**
48
+     * @var string
49
+     */
50
+    protected $result_collection_type = PlaceResultsCollection::class;
51
+
52
+    /**
53
+     * @param string     $query
54
+     * @param array|null $params
55
+     * @param array|null $fields
56
+     *
57
+     * @return GoogleMapsResultsCollection
58
+     * @see https://developers.google.com/places/web-service/search#FindPlaceRequests
59
+     */
60
+    public function findPlaceByText(
61
+        string $query,
62
+        ?array $params = [],
63
+        ?array $fields = []
64
+    ): GoogleMapsResultsCollection {
65
+
66
+        $params = array_merge($params, [
67
+            GoogleMapsRequestFields::INPUT  => $query,
68
+            GoogleMapsRequestFields::FIELDS => implode(',', $fields)
69
+        ]);
70
+
71
+        return $this->findPlace($params);
72
+
73
+    }
74
+
75
+    /**
76
+     * Find Places requests
77
+     *
78
+     * @param array $params
79
+     *        GoogleMapsRequestFields::INPUT required
80
+     *
81
+     * @see     https://developers.google.com/places/web-service/search#FindPlaceRequests
82
+     * @return GoogleMapsResultsCollection
83
+     * @throws InvalidArgumentException
84
+     * @since   0.5.0
85
+     */
86
+    public function findPlace(array $params): GoogleMapsResultsCollection
87
+    {
88
+
89
+        // see \Biscolab\GoogleMaps\Values\PlaceInputTypeValues
90
+        if (empty($params[GoogleMapsRequestFields::INPUTTYPE])) {
91
+            $params[GoogleMapsRequestFields::INPUTTYPE] = PlaceInputTypeValues::TEXTQUERY;
92
+        }
93
+
94
+        if (empty($params[GoogleMapsRequestFields::INPUT])) {
95
+            throw new InvalidArgumentException(GoogleMapsRequestFields::INPUT . " field is required");
96
+        }
97
+
98
+        return $this->makeApiCall($params, PlaceServicesEndpoints::FINDPLACEFROMTEXT);
99
+    }
100
+
101
+    /**
102
+     * @param array  $params
103
+     * @param string $endpoint
104
+     *
105
+     * @return GoogleMapsResult|GoogleMapsResultsCollection
106
+     * @since   0.5.0
107
+     */
108
+    public function makeApiCall(array $params, string $endpoint)
109
+    {
110
+
111
+        return $this->callApi($params, $endpoint);
112
+    }
113
+
114
+    /**
115
+     * @param string     $number
116
+     * @param array|null $params
117
+     * @param array|null $fields
118
+     *
119
+     * @return GoogleMapsResultsCollection
120
+     */
121
+    public function findPlaceByPhoneNumber(
122
+        string $number,
123
+        ?array $params = [],
124
+        ?array $fields = []
125
+    ): GoogleMapsResultsCollection {
126
+
127
+        $params = array_merge($params, [
128
+            GoogleMapsRequestFields::INPUT     => $number,
129
+            GoogleMapsRequestFields::INPUTTYPE => PlaceInputTypeValues::PHONENUMBER,
130
+            GoogleMapsRequestFields::FIELDS    => implode(',', $fields)
131
+        ]);
132
+
133
+        return $this->findPlace($params);
134
+
135
+    }
136
+
137
+    /**
138
+     * @param Location   $location
139
+     * @param int        $radius
140
+     * @param array|null $params
141
+     *
142
+     * @return GoogleMapsResultsCollection
143
+     */
144
+    public function findNearbyPlaceByRadius(
145
+        Location $location,
146
+        int $radius,
147
+        ?array $params = []
148
+    ): GoogleMapsResultsCollection {
149
+
150
+        $params = array_merge($params, [
151
+            GoogleMapsRequestFields::LOCATION => $location,
152
+            GoogleMapsRequestFields::RADIUS   => $radius
153
+        ]);
154
+
155
+        return $this->findNearbyPlace($params);
156
+    }
157
+
158
+    /**
159
+     * Nearby Search requests
160
+     *
161
+     * @param array $params
162
+     *
163
+     * @return GoogleMapsResultsCollection
164
+     *
165
+     * @throws InvalidArgumentException
166
+     * @see     https://developers.google.com/places/web-service/search#PlaceSearchRequests
167
+     * @since   0.5.0
168
+     */
169
+    public function findNearbyPlace(array $params): GoogleMapsResultsCollection
170
+    {
171
+
172
+        if (!empty($params[GoogleMapsRequestFields::LOCATION])) {//-33.8670522,151.1957362
173
+            $location = $params[GoogleMapsRequestFields::LOCATION];
174
+            if (!$location instanceof Location) {
175
+                throw new InvalidArgumentException(GoogleMapsRequestFields::LOCATION . ' field must be instance of ' . Location::class . ' class');
176
+            }
177
+            $params[GoogleMapsRequestFields::LOCATION] = (string)$params[GoogleMapsRequestFields::LOCATION];
178
+        } else {
179
+            throw new InvalidArgumentException(GoogleMapsResultFields::LOCATION . ' field is required');
180
+        }
181
+
182
+        if (!empty($params[GoogleMapsRequestFields::RANKBY]) &&
183
+            $params[GoogleMapsRequestFields::RANKBY] === RankByValues::DISTANCE
184
+        ) {
185
+            if (empty($params[GoogleMapsRequestFields::KEYWORD]) &&
186
+                empty($params[GoogleMapsRequestFields::NAME]) &&
187
+                empty($params[GoogleMapsRequestFields::TYPE])) {
188 188
 //				If rankby=distance (described under Optional parameters below) is specified,
189 189
 // 				then one or more of keyword, name, or type is required.
190
-				throw new InvalidArgumentException('If ' . GoogleMapsRequestFields::RANKBY . ' is set as "' . RankByValues::DISTANCE . '" one or more of ' . GoogleMapsRequestFields::KEYWORD . ', ' . GoogleMapsRequestFields::NAME . ', ' . GoogleMapsRequestFields::TYPE . ' fields are required');
191
-			}
192
-			if (!empty($params[GoogleMapsRequestFields::RADIUS])) {
190
+                throw new InvalidArgumentException('If ' . GoogleMapsRequestFields::RANKBY . ' is set as "' . RankByValues::DISTANCE . '" one or more of ' . GoogleMapsRequestFields::KEYWORD . ', ' . GoogleMapsRequestFields::NAME . ', ' . GoogleMapsRequestFields::TYPE . ' fields are required');
191
+            }
192
+            if (!empty($params[GoogleMapsRequestFields::RADIUS])) {
193 193
 // 				Note that radius must not be included if rankby=distance (described under Optional parameters below) is specified.
194
-				throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must not be included if ' . GoogleMapsRequestFields::RANKBY . ' = ' . RankByValues::DISTANCE);
195
-			}
196
-		} elseif (empty($params[GoogleMapsRequestFields::RADIUS])) {
194
+                throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must not be included if ' . GoogleMapsRequestFields::RANKBY . ' = ' . RankByValues::DISTANCE);
195
+            }
196
+        } elseif (empty($params[GoogleMapsRequestFields::RADIUS])) {
197 197
 //			radius — Defines the distance (in meters) within which to return place results.
198
-			throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' field is required');
199
-		}
198
+            throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' field is required');
199
+        }
200 200
 
201
-		if (!empty($params[GoogleMapsRequestFields::RADIUS]) && floatval($params[GoogleMapsRequestFields::RADIUS]) > Config::MAX_PLACE_RADIUS_VALUE) {
201
+        if (!empty($params[GoogleMapsRequestFields::RADIUS]) && floatval($params[GoogleMapsRequestFields::RADIUS]) > Config::MAX_PLACE_RADIUS_VALUE) {
202 202
 // 			The maximum allowed radius is 50 000 meters.
203
-			throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must be lower than ' . Config::MAX_PLACE_RADIUS_VALUE);
204
-		}
205
-
206
-		return $this->makeApiCall($params, PlaceServicesEndpoints::NEARBYSEARCH);
207
-	}
208
-
209
-	/**
210
-	 * @param Location $location
211
-	 * @param array    $params
212
-	 *
213
-	 * @return GoogleMapsResultsCollection
214
-	 */
215
-	public function findNearbyPlaceByDistance(Location $location, array $params): GoogleMapsResultsCollection
216
-	{
217
-
218
-		$params = array_merge($params, [
219
-			GoogleMapsRequestFields::LOCATION => $location,
220
-			GoogleMapsRequestFields::RANKBY   => RankByValues::DISTANCE
221
-		]);
222
-
223
-		return $this->findNearbyPlace($params);
224
-	}
225
-
226
-	/**
227
-	 * Nearby Search requests
228
-	 *
229
-	 * @param string     $query
230
-	 * @param array|null $params
231
-	 *
232
-	 * @see     https://developers.google.com/places/web-service/search#TextSearchRequests
233
-	 * @return GoogleMapsResultsCollection
234
-	 * @throws InvalidArgumentException
235
-	 * @since   0.5.0
236
-	 */
237
-	public function textSearch(string $query, ?array $params = []): GoogleMapsResultsCollection
238
-	{
239
-
240
-		$params = array_merge($params, [
241
-			GoogleMapsRequestFields::QUERY => $query
242
-		]);
243
-
244
-		return $this->makeApiCall($params, PlaceServicesEndpoints::TEXTSEARCH);
245
-	}
246
-
247
-	/**
248
-	 * @param string     $place_id
249
-	 * @param array|null $params
250
-	 *
251
-	 * @return GoogleMapsResult
252
-	 * @see https://developers.google.com/places/web-service/details
253
-	 * @since v0.6.0
254
-	 */
255
-	public function details(string $place_id, ?array $params = []): GoogleMapsResult
256
-	{
257
-
258
-		$params = array_merge($params, [
259
-			GoogleMapsRequestFields::PLACE_ID => $place_id
260
-		]);
261
-
262
-		return $this->makeApiCall($params, PlaceServicesEndpoints::DETAILS);
263
-
264
-	}
203
+            throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must be lower than ' . Config::MAX_PLACE_RADIUS_VALUE);
204
+        }
205
+
206
+        return $this->makeApiCall($params, PlaceServicesEndpoints::NEARBYSEARCH);
207
+    }
208
+
209
+    /**
210
+     * @param Location $location
211
+     * @param array    $params
212
+     *
213
+     * @return GoogleMapsResultsCollection
214
+     */
215
+    public function findNearbyPlaceByDistance(Location $location, array $params): GoogleMapsResultsCollection
216
+    {
217
+
218
+        $params = array_merge($params, [
219
+            GoogleMapsRequestFields::LOCATION => $location,
220
+            GoogleMapsRequestFields::RANKBY   => RankByValues::DISTANCE
221
+        ]);
222
+
223
+        return $this->findNearbyPlace($params);
224
+    }
225
+
226
+    /**
227
+     * Nearby Search requests
228
+     *
229
+     * @param string     $query
230
+     * @param array|null $params
231
+     *
232
+     * @see     https://developers.google.com/places/web-service/search#TextSearchRequests
233
+     * @return GoogleMapsResultsCollection
234
+     * @throws InvalidArgumentException
235
+     * @since   0.5.0
236
+     */
237
+    public function textSearch(string $query, ?array $params = []): GoogleMapsResultsCollection
238
+    {
239
+
240
+        $params = array_merge($params, [
241
+            GoogleMapsRequestFields::QUERY => $query
242
+        ]);
243
+
244
+        return $this->makeApiCall($params, PlaceServicesEndpoints::TEXTSEARCH);
245
+    }
246
+
247
+    /**
248
+     * @param string     $place_id
249
+     * @param array|null $params
250
+     *
251
+     * @return GoogleMapsResult
252
+     * @see https://developers.google.com/places/web-service/details
253
+     * @since v0.6.0
254
+     */
255
+    public function details(string $place_id, ?array $params = []): GoogleMapsResult
256
+    {
257
+
258
+        $params = array_merge($params, [
259
+            GoogleMapsRequestFields::PLACE_ID => $place_id
260
+        ]);
261
+
262
+        return $this->makeApiCall($params, PlaceServicesEndpoints::DETAILS);
263
+
264
+    }
265 265
 
266 266
 }
267 267
\ No newline at end of file
Please login to merge, or discard this patch.
src/Utils/Config.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@
 block discarded – undo
17 17
  */
18 18
 class Config
19 19
 {
20
-	/**
21
-	 * @var int
22
-	 */
23
-	const  MAX_PLACE_RADIUS_VALUE = 50000;
20
+    /**
21
+     * @var int
22
+     */
23
+    const  MAX_PLACE_RADIUS_VALUE = 50000;
24 24
 }
25 25
\ No newline at end of file
Please login to merge, or discard this patch.