Completed
Push — master ( d33c99...5d6517 )
by Roberto
03:55 queued 10s
created
src/Fields/LatLngBoundsFields.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@
 block discarded – undo
17 17
 class LatLngBoundsFields
18 18
 {
19 19
 
20
-	/**
21
-	 * string : northeast
22
-	 */
23
-	const NORTHEAST = 'northeast';
20
+    /**
21
+     * string : northeast
22
+     */
23
+    const NORTHEAST = 'northeast';
24 24
 
25
-	/**
26
-	 * string : southwest
27
-	 */
28
-	const SOUTHWEST = 'southwest';
25
+    /**
26
+     * string : southwest
27
+     */
28
+    const SOUTHWEST = 'southwest';
29 29
 }
30 30
\ No newline at end of file
Please login to merge, or discard this patch.
src/Fields/GoogleMapsRequestFields.php 1 patch
Indentation   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -17,145 +17,145 @@
 block discarded – undo
17 17
 class GoogleMapsRequestFields
18 18
 {
19 19
 
20
-	/**
21
-	 * @var string key
22
-	 */
23
-	const KEY = 'key';
24
-
25
-	/**
26
-	 * @var string sensor
27
-	 */
28
-	const SENSOR = 'sensor';
29
-
30
-	/**
31
-	 * @var string latlng
32
-	 */
33
-	const LATLNG = 'latlng';
34
-
35
-	/**
36
-	 * @var string address
37
-	 */
38
-	const ADDRESS = 'address';
39
-
40
-	/**
41
-	 * @var string place_id
42
-	 */
43
-	const PLACE_ID = 'place_id';
44
-
45
-	/**
46
-	 * @var string location
47
-	 * @since 0.5.0
48
-	 */
49
-	const LOCATION = 'location';
50
-
51
-	/**
52
-	 * @var string locations
53
-	 */
54
-	const LOCATIONS = 'locations';
55
-
56
-	/**
57
-	 * @var string path
58
-	 */
59
-	const PATH = 'path';
60
-
61
-	/**
62
-	 * @var string samples
63
-	 */
64
-	const SAMPLES = 'samples';
65
-
66
-	/**
67
-	 * @var string input
68
-	 * @since 0.5.0
69
-	 */
70
-	const INPUT = 'input';
71
-
72
-	/**
73
-	 * @var string inputtype
74
-	 * @since 0.5.0
75
-	 */
76
-	const INPUTTYPE = 'inputtype';
77
-
78
-	/**
79
-	 * @var string language
80
-	 * @since 0.5.0
81
-	 */
82
-	const LANGUAGE = 'language';
83
-
84
-	/**
85
-	 * @var string fields
86
-	 * @since 0.5.0
87
-	 */
88
-	const FIELDS = 'fields';
89
-
90
-	/**
91
-	 * @var string locationbias
92
-	 * @since 0.5.0
93
-	 */
94
-	const LOCATIONBIAS = 'locationbias';
95
-
96
-	/**
97
-	 * @var string radius
98
-	 * @since 0.5.0
99
-	 */
100
-	const RADIUS = 'radius';
101
-
102
-	/**
103
-	 * @var string rankby
104
-	 * @since 0.5.0
105
-	 */
106
-	const RANKBY = 'rankby';
107
-
108
-	/**
109
-	 * @var string keyword
110
-	 * @since 0.5.0
111
-	 */
112
-	const KEYWORD = 'keyword';
113
-
114
-	/**
115
-	 * @var string minprice
116
-	 * @since 0.5.0
117
-	 */
118
-	const MINPRICE = 'minprice';
119
-
120
-	/**
121
-	 * @var string maxprice
122
-	 * @since 0.5.0
123
-	 */
124
-	const MAXPRICE = 'maxprice';
125
-
126
-	/**
127
-	 * @var string name
128
-	 * @since 0.5.0
129
-	 */
130
-	const NAME = 'name';
131
-
132
-	/**
133
-	 * @var string opennow
134
-	 * @since 0.5.0
135
-	 */
136
-	const OPENNOW = 'opennow';
137
-
138
-	/**
139
-	 * @var string pagetoken
140
-	 * @since 0.5.0
141
-	 */
142
-	const PAGETOKEN = 'pagetoken';
143
-
144
-	/**
145
-	 * @var string type
146
-	 * @since 0.5.0
147
-	 */
148
-	const TYPE = 'type';
149
-
150
-	/**
151
-	 * @var string query
152
-	 * @since 0.5.0
153
-	 */
154
-	const QUERY = 'query';
155
-
156
-	/**
157
-	 * @var string next_page_token
158
-	 * @since 0.5.0
159
-	 */
160
-	const NEXT_PAGE_TOKEN = 'next_page_token';
20
+    /**
21
+     * @var string key
22
+     */
23
+    const KEY = 'key';
24
+
25
+    /**
26
+     * @var string sensor
27
+     */
28
+    const SENSOR = 'sensor';
29
+
30
+    /**
31
+     * @var string latlng
32
+     */
33
+    const LATLNG = 'latlng';
34
+
35
+    /**
36
+     * @var string address
37
+     */
38
+    const ADDRESS = 'address';
39
+
40
+    /**
41
+     * @var string place_id
42
+     */
43
+    const PLACE_ID = 'place_id';
44
+
45
+    /**
46
+     * @var string location
47
+     * @since 0.5.0
48
+     */
49
+    const LOCATION = 'location';
50
+
51
+    /**
52
+     * @var string locations
53
+     */
54
+    const LOCATIONS = 'locations';
55
+
56
+    /**
57
+     * @var string path
58
+     */
59
+    const PATH = 'path';
60
+
61
+    /**
62
+     * @var string samples
63
+     */
64
+    const SAMPLES = 'samples';
65
+
66
+    /**
67
+     * @var string input
68
+     * @since 0.5.0
69
+     */
70
+    const INPUT = 'input';
71
+
72
+    /**
73
+     * @var string inputtype
74
+     * @since 0.5.0
75
+     */
76
+    const INPUTTYPE = 'inputtype';
77
+
78
+    /**
79
+     * @var string language
80
+     * @since 0.5.0
81
+     */
82
+    const LANGUAGE = 'language';
83
+
84
+    /**
85
+     * @var string fields
86
+     * @since 0.5.0
87
+     */
88
+    const FIELDS = 'fields';
89
+
90
+    /**
91
+     * @var string locationbias
92
+     * @since 0.5.0
93
+     */
94
+    const LOCATIONBIAS = 'locationbias';
95
+
96
+    /**
97
+     * @var string radius
98
+     * @since 0.5.0
99
+     */
100
+    const RADIUS = 'radius';
101
+
102
+    /**
103
+     * @var string rankby
104
+     * @since 0.5.0
105
+     */
106
+    const RANKBY = 'rankby';
107
+
108
+    /**
109
+     * @var string keyword
110
+     * @since 0.5.0
111
+     */
112
+    const KEYWORD = 'keyword';
113
+
114
+    /**
115
+     * @var string minprice
116
+     * @since 0.5.0
117
+     */
118
+    const MINPRICE = 'minprice';
119
+
120
+    /**
121
+     * @var string maxprice
122
+     * @since 0.5.0
123
+     */
124
+    const MAXPRICE = 'maxprice';
125
+
126
+    /**
127
+     * @var string name
128
+     * @since 0.5.0
129
+     */
130
+    const NAME = 'name';
131
+
132
+    /**
133
+     * @var string opennow
134
+     * @since 0.5.0
135
+     */
136
+    const OPENNOW = 'opennow';
137
+
138
+    /**
139
+     * @var string pagetoken
140
+     * @since 0.5.0
141
+     */
142
+    const PAGETOKEN = 'pagetoken';
143
+
144
+    /**
145
+     * @var string type
146
+     * @since 0.5.0
147
+     */
148
+    const TYPE = 'type';
149
+
150
+    /**
151
+     * @var string query
152
+     * @since 0.5.0
153
+     */
154
+    const QUERY = 'query';
155
+
156
+    /**
157
+     * @var string next_page_token
158
+     * @since 0.5.0
159
+     */
160
+    const NEXT_PAGE_TOKEN = 'next_page_token';
161 161
 }
162 162
\ No newline at end of file
Please login to merge, or discard this patch.
src/Fields/GoogleMapsResultFields.php 1 patch
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -17,126 +17,126 @@
 block discarded – undo
17 17
 class GoogleMapsResultFields
18 18
 {
19 19
 
20
-	/**
21
-	 * @var string address_components
22
-	 */
23
-	const ADDRESS_COMPONENTS = 'address_components';
24
-
25
-	/**
26
-	 * @var string formatted_address
27
-	 */
28
-	const FORMATTED_ADDRESS = 'formatted_address';
29
-
30
-	/**
31
-	 * @var string geometry
32
-	 */
33
-	const GEOMETRY = 'geometry';
34
-
35
-	/**
36
-	 * @var string viewport
37
-	 */
38
-	const VIEWPORT = 'viewport';
39
-
40
-	/**
41
-	 * @var string place_id
42
-	 */
43
-	const PLACE_ID = 'place_id';
44
-
45
-	/**
46
-	 * @var string location_type
47
-	 */
48
-	const LOCATION_TYPE = 'location_type';
49
-
50
-	/**
51
-	 * @var string types
52
-	 */
53
-	const TYPES = 'types';
54
-
55
-	/**
56
-	 * @var string location
57
-	 */
58
-	const LOCATION = 'location';
59
-
60
-	/**
61
-	 * @var string elevation
62
-	 */
63
-	const ELEVATION = 'elevation';
64
-
65
-	/**
66
-	 * @var string resolution
67
-	 */
68
-	const RESOLUTION = 'resolution';
69
-
70
-	/**
71
-	 * @var string icon
72
-	 * @since 0.5.0
73
-	 */
74
-	const ICON = 'icon';
75
-
76
-	/**
77
-	 * @var string id
78
-	 * @since 0.5.0
79
-	 */
80
-	const ID = 'id';
81
-
82
-	/**
83
-	 * @var string name
84
-	 * @since 0.5.0
85
-	 */
86
-	const NAME = 'name';
87
-
88
-	/**
89
-	 * @var string photos
90
-	 * @since 0.5.0
91
-	 */
92
-	const PHOTOS = 'photos';
93
-
94
-	/**
95
-	 * @var string reference
96
-	 * @since 0.5.0
97
-	 */
98
-	const REFERENCE = 'reference';
99
-
100
-	/**
101
-	 * @var string vicinity
102
-	 * @since 0.5.0
103
-	 */
104
-	const VICINITY = 'vicinity';
105
-
106
-	/**
107
-	 * @var string opening_hours
108
-	 * @since 0.5.0
109
-	 */
110
-	const OPENING_HOURS = 'opening_hours';
111
-
112
-	/**
113
-	 * @var string price_level
114
-	 * @since 0.5.0
115
-	 */
116
-	const PRICE_LEVEL = 'price_level';
117
-
118
-	/**
119
-	 * @var string rating
120
-	 * @since 0.5.0
121
-	 */
122
-	const RATING = 'rating';
123
-
124
-	/**
125
-	 * @var string permanently_closed
126
-	 * @since 0.5.0
127
-	 */
128
-	const PERMANENTLY_CLOSED = 'permanently_closed';
129
-
130
-	/**
131
-	 * @var string plus_code
132
-	 * @since 0.5.0
133
-	 */
134
-	const PLUS_CODE = 'plus_code';
135
-
136
-	/**
137
-	 * @var string next_page_token
138
-	 * @since 0.5.0
139
-	 */
140
-	const NEXT_PAGE_TOKEN = 'next_page_token';
20
+    /**
21
+     * @var string address_components
22
+     */
23
+    const ADDRESS_COMPONENTS = 'address_components';
24
+
25
+    /**
26
+     * @var string formatted_address
27
+     */
28
+    const FORMATTED_ADDRESS = 'formatted_address';
29
+
30
+    /**
31
+     * @var string geometry
32
+     */
33
+    const GEOMETRY = 'geometry';
34
+
35
+    /**
36
+     * @var string viewport
37
+     */
38
+    const VIEWPORT = 'viewport';
39
+
40
+    /**
41
+     * @var string place_id
42
+     */
43
+    const PLACE_ID = 'place_id';
44
+
45
+    /**
46
+     * @var string location_type
47
+     */
48
+    const LOCATION_TYPE = 'location_type';
49
+
50
+    /**
51
+     * @var string types
52
+     */
53
+    const TYPES = 'types';
54
+
55
+    /**
56
+     * @var string location
57
+     */
58
+    const LOCATION = 'location';
59
+
60
+    /**
61
+     * @var string elevation
62
+     */
63
+    const ELEVATION = 'elevation';
64
+
65
+    /**
66
+     * @var string resolution
67
+     */
68
+    const RESOLUTION = 'resolution';
69
+
70
+    /**
71
+     * @var string icon
72
+     * @since 0.5.0
73
+     */
74
+    const ICON = 'icon';
75
+
76
+    /**
77
+     * @var string id
78
+     * @since 0.5.0
79
+     */
80
+    const ID = 'id';
81
+
82
+    /**
83
+     * @var string name
84
+     * @since 0.5.0
85
+     */
86
+    const NAME = 'name';
87
+
88
+    /**
89
+     * @var string photos
90
+     * @since 0.5.0
91
+     */
92
+    const PHOTOS = 'photos';
93
+
94
+    /**
95
+     * @var string reference
96
+     * @since 0.5.0
97
+     */
98
+    const REFERENCE = 'reference';
99
+
100
+    /**
101
+     * @var string vicinity
102
+     * @since 0.5.0
103
+     */
104
+    const VICINITY = 'vicinity';
105
+
106
+    /**
107
+     * @var string opening_hours
108
+     * @since 0.5.0
109
+     */
110
+    const OPENING_HOURS = 'opening_hours';
111
+
112
+    /**
113
+     * @var string price_level
114
+     * @since 0.5.0
115
+     */
116
+    const PRICE_LEVEL = 'price_level';
117
+
118
+    /**
119
+     * @var string rating
120
+     * @since 0.5.0
121
+     */
122
+    const RATING = 'rating';
123
+
124
+    /**
125
+     * @var string permanently_closed
126
+     * @since 0.5.0
127
+     */
128
+    const PERMANENTLY_CLOSED = 'permanently_closed';
129
+
130
+    /**
131
+     * @var string plus_code
132
+     * @since 0.5.0
133
+     */
134
+    const PLUS_CODE = 'plus_code';
135
+
136
+    /**
137
+     * @var string next_page_token
138
+     * @since 0.5.0
139
+     */
140
+    const NEXT_PAGE_TOKEN = 'next_page_token';
141 141
 
142 142
 }
143 143
\ No newline at end of file
Please login to merge, or discard this patch.
src/Fields/LatLngFields.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@
 block discarded – undo
17 17
 class LatLngFields
18 18
 {
19 19
 
20
-	/**
21
-	 * string - latitude
22
-	 */
23
-	const LAT = 'lat';
20
+    /**
21
+     * string - latitude
22
+     */
23
+    const LAT = 'lat';
24 24
 
25
-	/**
26
-	 * string - longitude
27
-	 */
28
-	const LNG = 'lng';
25
+    /**
26
+     * string - longitude
27
+     */
28
+    const LNG = 'lng';
29 29
 }
30 30
\ No newline at end of file
Please login to merge, or discard this patch.
src/Fields/PhotoFields.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -17,23 +17,23 @@
 block discarded – undo
17 17
 class PhotoFields
18 18
 {
19 19
 
20
-	/**
21
-	 * @var string
22
-	 */
23
-	const HEIGHT = "height";
20
+    /**
21
+     * @var string
22
+     */
23
+    const HEIGHT = "height";
24 24
 
25
-	/**
26
-	 * @var string
27
-	 */
28
-	const WIDTH = "width";
25
+    /**
26
+     * @var string
27
+     */
28
+    const WIDTH = "width";
29 29
 
30
-	/**
31
-	 * @var string
32
-	 */
33
-	const PHOTO_REFERENCE = "photo_reference";
30
+    /**
31
+     * @var string
32
+     */
33
+    const PHOTO_REFERENCE = "photo_reference";
34 34
 
35
-	/**
36
-	 * @var string
37
-	 */
38
-	const HTML_ATTRIBUTIONS = "html_attributions";
35
+    /**
36
+     * @var string
37
+     */
38
+    const HTML_ATTRIBUTIONS = "html_attributions";
39 39
 }
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
src/Fields/GoogleMapsResponseFields.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -17,37 +17,37 @@
 block discarded – undo
17 17
 class GoogleMapsResponseFields
18 18
 {
19 19
 
20
-	/**
21
-	 * @var string results
22
-	 */
23
-	const RESULTS = 'results';
24
-
25
-	/**
26
-	 * @var string status
27
-	 */
28
-	const STATUS = 'status';
29
-
30
-	/**
31
-	 * @var string error_message
32
-	 */
33
-	const ERROR_MESSAGE = 'error_message';
34
-
35
-	/**
36
-	 * @var string candidates
37
-	 * @since 0.5.0
38
-	 */
39
-	const CANDIDATES = 'candidates';
40
-
41
-	/**
42
-	 * @var string html_attributions
43
-	 * @since 0.5.0
44
-	 */
45
-	const HTML_ATTRIBUTIONS = 'html_attributions';
46
-
47
-	/**
48
-	 * @var string next_page_token
49
-	 * @since 0.5.0
50
-	 */
51
-	const NEXT_PAGE_TOKEN = 'next_page_token';
20
+    /**
21
+     * @var string results
22
+     */
23
+    const RESULTS = 'results';
24
+
25
+    /**
26
+     * @var string status
27
+     */
28
+    const STATUS = 'status';
29
+
30
+    /**
31
+     * @var string error_message
32
+     */
33
+    const ERROR_MESSAGE = 'error_message';
34
+
35
+    /**
36
+     * @var string candidates
37
+     * @since 0.5.0
38
+     */
39
+    const CANDIDATES = 'candidates';
40
+
41
+    /**
42
+     * @var string html_attributions
43
+     * @since 0.5.0
44
+     */
45
+    const HTML_ATTRIBUTIONS = 'html_attributions';
46
+
47
+    /**
48
+     * @var string next_page_token
49
+     * @since 0.5.0
50
+     */
51
+    const NEXT_PAGE_TOKEN = 'next_page_token';
52 52
 
53 53
 }
54 54
\ No newline at end of file
Please login to merge, or discard this patch.
src/Fields/GeometryFields.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,19 +17,19 @@
 block discarded – undo
17 17
 class GeometryFields
18 18
 {
19 19
 
20
-	/**
21
-	 * string: location
22
-	 */
23
-	const LOCATION = 'location';
20
+    /**
21
+     * string: location
22
+     */
23
+    const LOCATION = 'location';
24 24
 
25
-	/**
26
-	 * string: location_type
27
-	 */
28
-	const LOCATION_TYPE = 'location_type';
25
+    /**
26
+     * string: location_type
27
+     */
28
+    const LOCATION_TYPE = 'location_type';
29 29
 
30
-	/**
31
-	 * string: viewport
32
-	 */
33
-	const VIEWPORT = 'viewport';
30
+    /**
31
+     * string: viewport
32
+     */
33
+    const VIEWPORT = 'viewport';
34 34
 
35 35
 }
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
src/Fields/AddressComponentFields.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,19 +17,19 @@
 block discarded – undo
17 17
 class AddressComponentFields
18 18
 {
19 19
 
20
-	/**
21
-	 * string: long_name
22
-	 */
23
-	const LONG_NAME = 'long_name';
20
+    /**
21
+     * string: long_name
22
+     */
23
+    const LONG_NAME = 'long_name';
24 24
 
25
-	/**
26
-	 * string: short_name
27
-	 */
28
-	const SHORT_NAME = 'short_name';
25
+    /**
26
+     * string: short_name
27
+     */
28
+    const SHORT_NAME = 'short_name';
29 29
 
30
-	/**
31
-	 * string: types
32
-	 */
33
-	const TYPES = 'types';
30
+    /**
31
+     * string: types
32
+     */
33
+    const TYPES = 'types';
34 34
 
35 35
 }
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
src/Api/Places.php 2 patches
Indentation   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -32,206 +32,206 @@
 block discarded – undo
32 32
 class Places extends Api
33 33
 {
34 34
 
35
-	/**
36
-	 * @var string
37
-	 */
38
-	const SERVICE_ENDPOINT = 'place';
39
-
40
-	/**
41
-	 * @var string
42
-	 */
43
-	protected $result_collection = PlaceResultsCollection::class;
44
-
45
-	/**
46
-	 * @param string     $query
47
-	 * @param array|null $params
48
-	 * @param array|null $fields
49
-	 *
50
-	 * @return GoogleMapsResultsCollection
51
-	 * @see https://developers.google.com/places/web-service/search#FindPlaceRequests
52
-	 */
53
-	public function findPlaceByText(
54
-		string $query,
55
-		?array $params = [],
56
-		?array $fields = []
57
-	): GoogleMapsResultsCollection {
58
-
59
-		$params = array_merge($params, [
60
-			GoogleMapsRequestFields::INPUT  => $query,
61
-			GoogleMapsRequestFields::FIELDS => implode(',', $fields)
62
-		]);
63
-
64
-		return $this->findPlace($params);
65
-
66
-	}
67
-
68
-	/**
69
-	 * Find Places requests
70
-	 *
71
-	 * @param array $params
72
-	 *        GoogleMapsRequestFields::INPUT required
73
-	 *
74
-	 * @see     https://developers.google.com/places/web-service/search#FindPlaceRequests
75
-	 * @return GoogleMapsResultsCollection
76
-	 * @throws InvalidArgumentException
77
-	 * @since   0.5.0
78
-	 */
79
-	public function findPlace(array $params): GoogleMapsResultsCollection
80
-	{
81
-
82
-		// see \Biscolab\GoogleMaps\Values\PlaceInputTypeValues
83
-		if (empty($params[GoogleMapsRequestFields::INPUTTYPE])) {
84
-			$params[GoogleMapsRequestFields::INPUTTYPE] = PlaceInputTypeValues::TEXTQUERY;
85
-		}
86
-
87
-		if (empty($params[GoogleMapsRequestFields::INPUT])) {
88
-			throw new InvalidArgumentException(GoogleMapsRequestFields::INPUT . " field is required");
89
-		}
90
-
91
-		return $this->makeApiCall($params, PlaceServicesEndpoints::FINDPLACEFROMTEXT);
92
-	}
93
-
94
-	/**
95
-	 * @param array  $params
96
-	 * @param string $endpoint
97
-	 *
98
-	 * @return GoogleMapsResultsCollection
99
-	 * @since   0.5.0
100
-	 */
101
-	public function makeApiCall(array $params, string $endpoint): GoogleMapsResultsCollection
102
-	{
103
-
104
-		return $this->callApi($params, $endpoint);
105
-	}
106
-
107
-	/**
108
-	 * @param string     $number
109
-	 * @param array|null $params
110
-	 * @param array|null $fields
111
-	 *
112
-	 * @return GoogleMapsResultsCollection
113
-	 */
114
-	public function findPlaceByPhoneNumber(
115
-		string $number,
116
-		?array $params = [],
117
-		?array $fields = []
118
-	): GoogleMapsResultsCollection {
119
-
120
-		$params = array_merge($params, [
121
-			GoogleMapsRequestFields::INPUT     => $number,
122
-			GoogleMapsRequestFields::INPUTTYPE => PlaceInputTypeValues::PHONENUMBER,
123
-			GoogleMapsRequestFields::FIELDS    => implode(',', $fields)
124
-		]);
125
-
126
-		return $this->findPlace($params);
127
-
128
-	}
129
-
130
-	/**
131
-	 * @param Location   $location
132
-	 * @param int        $radius
133
-	 * @param array|null $params
134
-	 *
135
-	 * @return GoogleMapsResultsCollection
136
-	 */
137
-	public function findNearbyPlaceByRadius(Location $location, int $radius, ?array $params = []): GoogleMapsResultsCollection
138
-	{
139
-
140
-		$params = array_merge($params, [
141
-			GoogleMapsRequestFields::LOCATION => $location,
142
-			GoogleMapsRequestFields::RADIUS => $radius
143
-		]);
144
-
145
-		return $this->findNearbyPlace($params);
146
-	}
147
-
148
-	/**
149
-	 * @param Location $location
150
-	 * @param array    $params
151
-	 *
152
-	 * @return GoogleMapsResultsCollection
153
-	 */
154
-	public function findNearbyPlaceByDistance(Location $location, array $params): GoogleMapsResultsCollection
155
-	{
156
-
157
-		$params = array_merge($params, [
158
-			GoogleMapsRequestFields::LOCATION => $location,
159
-			GoogleMapsRequestFields::RANKBY => RankByValues::DISTANCE
160
-		]);
161
-
162
-		return $this->findNearbyPlace($params);
163
-	}
164
-
165
-	/**
166
-	 * Nearby Search requests
167
-	 *
168
-	 * @param array $params
169
-	 *
170
-	 * @return GoogleMapsResultsCollection
171
-	 *
172
-	 * @throws InvalidArgumentException
173
-	 * @see     https://developers.google.com/places/web-service/search#PlaceSearchRequests
174
-	 * @since   0.5.0
175
-	 */
176
-	public function findNearbyPlace(array $params): GoogleMapsResultsCollection
177
-	{
178
-
179
-		if (!empty($params[GoogleMapsRequestFields::LOCATION])) {//-33.8670522,151.1957362
180
-			$location = $params[GoogleMapsRequestFields::LOCATION];
181
-			if (!$location instanceof Location) {
182
-				throw new InvalidArgumentException(GoogleMapsRequestFields::LOCATION . ' field must be instance of ' . Location::class . ' class');
183
-			}
184
-			$params[GoogleMapsRequestFields::LOCATION] = (string)$params[GoogleMapsRequestFields::LOCATION];
185
-		} else {
186
-			throw new InvalidArgumentException(GoogleMapsResultFields::LOCATION . ' field is required');
187
-		}
188
-
189
-		if (!empty($params[GoogleMapsRequestFields::RANKBY]) &&
190
-			$params[GoogleMapsRequestFields::RANKBY] === RankByValues::DISTANCE
191
-		) {
192
-			if (empty($params[GoogleMapsRequestFields::KEYWORD]) &&
193
-				empty($params[GoogleMapsRequestFields::NAME]) &&
194
-				empty($params[GoogleMapsRequestFields::TYPE])) {
35
+    /**
36
+     * @var string
37
+     */
38
+    const SERVICE_ENDPOINT = 'place';
39
+
40
+    /**
41
+     * @var string
42
+     */
43
+    protected $result_collection = PlaceResultsCollection::class;
44
+
45
+    /**
46
+     * @param string     $query
47
+     * @param array|null $params
48
+     * @param array|null $fields
49
+     *
50
+     * @return GoogleMapsResultsCollection
51
+     * @see https://developers.google.com/places/web-service/search#FindPlaceRequests
52
+     */
53
+    public function findPlaceByText(
54
+        string $query,
55
+        ?array $params = [],
56
+        ?array $fields = []
57
+    ): GoogleMapsResultsCollection {
58
+
59
+        $params = array_merge($params, [
60
+            GoogleMapsRequestFields::INPUT  => $query,
61
+            GoogleMapsRequestFields::FIELDS => implode(',', $fields)
62
+        ]);
63
+
64
+        return $this->findPlace($params);
65
+
66
+    }
67
+
68
+    /**
69
+     * Find Places requests
70
+     *
71
+     * @param array $params
72
+     *        GoogleMapsRequestFields::INPUT required
73
+     *
74
+     * @see     https://developers.google.com/places/web-service/search#FindPlaceRequests
75
+     * @return GoogleMapsResultsCollection
76
+     * @throws InvalidArgumentException
77
+     * @since   0.5.0
78
+     */
79
+    public function findPlace(array $params): GoogleMapsResultsCollection
80
+    {
81
+
82
+        // see \Biscolab\GoogleMaps\Values\PlaceInputTypeValues
83
+        if (empty($params[GoogleMapsRequestFields::INPUTTYPE])) {
84
+            $params[GoogleMapsRequestFields::INPUTTYPE] = PlaceInputTypeValues::TEXTQUERY;
85
+        }
86
+
87
+        if (empty($params[GoogleMapsRequestFields::INPUT])) {
88
+            throw new InvalidArgumentException(GoogleMapsRequestFields::INPUT . " field is required");
89
+        }
90
+
91
+        return $this->makeApiCall($params, PlaceServicesEndpoints::FINDPLACEFROMTEXT);
92
+    }
93
+
94
+    /**
95
+     * @param array  $params
96
+     * @param string $endpoint
97
+     *
98
+     * @return GoogleMapsResultsCollection
99
+     * @since   0.5.0
100
+     */
101
+    public function makeApiCall(array $params, string $endpoint): GoogleMapsResultsCollection
102
+    {
103
+
104
+        return $this->callApi($params, $endpoint);
105
+    }
106
+
107
+    /**
108
+     * @param string     $number
109
+     * @param array|null $params
110
+     * @param array|null $fields
111
+     *
112
+     * @return GoogleMapsResultsCollection
113
+     */
114
+    public function findPlaceByPhoneNumber(
115
+        string $number,
116
+        ?array $params = [],
117
+        ?array $fields = []
118
+    ): GoogleMapsResultsCollection {
119
+
120
+        $params = array_merge($params, [
121
+            GoogleMapsRequestFields::INPUT     => $number,
122
+            GoogleMapsRequestFields::INPUTTYPE => PlaceInputTypeValues::PHONENUMBER,
123
+            GoogleMapsRequestFields::FIELDS    => implode(',', $fields)
124
+        ]);
125
+
126
+        return $this->findPlace($params);
127
+
128
+    }
129
+
130
+    /**
131
+     * @param Location   $location
132
+     * @param int        $radius
133
+     * @param array|null $params
134
+     *
135
+     * @return GoogleMapsResultsCollection
136
+     */
137
+    public function findNearbyPlaceByRadius(Location $location, int $radius, ?array $params = []): GoogleMapsResultsCollection
138
+    {
139
+
140
+        $params = array_merge($params, [
141
+            GoogleMapsRequestFields::LOCATION => $location,
142
+            GoogleMapsRequestFields::RADIUS => $radius
143
+        ]);
144
+
145
+        return $this->findNearbyPlace($params);
146
+    }
147
+
148
+    /**
149
+     * @param Location $location
150
+     * @param array    $params
151
+     *
152
+     * @return GoogleMapsResultsCollection
153
+     */
154
+    public function findNearbyPlaceByDistance(Location $location, array $params): GoogleMapsResultsCollection
155
+    {
156
+
157
+        $params = array_merge($params, [
158
+            GoogleMapsRequestFields::LOCATION => $location,
159
+            GoogleMapsRequestFields::RANKBY => RankByValues::DISTANCE
160
+        ]);
161
+
162
+        return $this->findNearbyPlace($params);
163
+    }
164
+
165
+    /**
166
+     * Nearby Search requests
167
+     *
168
+     * @param array $params
169
+     *
170
+     * @return GoogleMapsResultsCollection
171
+     *
172
+     * @throws InvalidArgumentException
173
+     * @see     https://developers.google.com/places/web-service/search#PlaceSearchRequests
174
+     * @since   0.5.0
175
+     */
176
+    public function findNearbyPlace(array $params): GoogleMapsResultsCollection
177
+    {
178
+
179
+        if (!empty($params[GoogleMapsRequestFields::LOCATION])) {//-33.8670522,151.1957362
180
+            $location = $params[GoogleMapsRequestFields::LOCATION];
181
+            if (!$location instanceof Location) {
182
+                throw new InvalidArgumentException(GoogleMapsRequestFields::LOCATION . ' field must be instance of ' . Location::class . ' class');
183
+            }
184
+            $params[GoogleMapsRequestFields::LOCATION] = (string)$params[GoogleMapsRequestFields::LOCATION];
185
+        } else {
186
+            throw new InvalidArgumentException(GoogleMapsResultFields::LOCATION . ' field is required');
187
+        }
188
+
189
+        if (!empty($params[GoogleMapsRequestFields::RANKBY]) &&
190
+            $params[GoogleMapsRequestFields::RANKBY] === RankByValues::DISTANCE
191
+        ) {
192
+            if (empty($params[GoogleMapsRequestFields::KEYWORD]) &&
193
+                empty($params[GoogleMapsRequestFields::NAME]) &&
194
+                empty($params[GoogleMapsRequestFields::TYPE])) {
195 195
 //				If rankby=distance (described under Optional parameters below) is specified,
196 196
 // 				then one or more of keyword, name, or type is required.
197
-				throw new InvalidArgumentException('If ' . GoogleMapsRequestFields::RANKBY . ' is set as "' . RankByValues::DISTANCE . '" one or more of ' . GoogleMapsRequestFields::KEYWORD . ', ' . GoogleMapsRequestFields::NAME . ', ' . GoogleMapsRequestFields::TYPE . ' fields are required');
198
-			}
199
-			if (!empty($params[GoogleMapsRequestFields::RADIUS])) {
197
+                throw new InvalidArgumentException('If ' . GoogleMapsRequestFields::RANKBY . ' is set as "' . RankByValues::DISTANCE . '" one or more of ' . GoogleMapsRequestFields::KEYWORD . ', ' . GoogleMapsRequestFields::NAME . ', ' . GoogleMapsRequestFields::TYPE . ' fields are required');
198
+            }
199
+            if (!empty($params[GoogleMapsRequestFields::RADIUS])) {
200 200
 // 				Note that radius must not be included if rankby=distance (described under Optional parameters below) is specified.
201
-				throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must not be included if ' . GoogleMapsRequestFields::RANKBY . ' = ' . RankByValues::DISTANCE);
202
-			}
203
-		} elseif (empty($params[GoogleMapsRequestFields::RADIUS])) {
201
+                throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must not be included if ' . GoogleMapsRequestFields::RANKBY . ' = ' . RankByValues::DISTANCE);
202
+            }
203
+        } elseif (empty($params[GoogleMapsRequestFields::RADIUS])) {
204 204
 //			radius — Defines the distance (in meters) within which to return place results.
205
-			throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' field is required');
206
-		}
205
+            throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' field is required');
206
+        }
207 207
 
208
-		if (!empty($params[GoogleMapsRequestFields::RADIUS]) && floatval($params[GoogleMapsRequestFields::RADIUS]) > Util::MAX_PLACE_RADIUS_VALUE) {
208
+        if (!empty($params[GoogleMapsRequestFields::RADIUS]) && floatval($params[GoogleMapsRequestFields::RADIUS]) > Util::MAX_PLACE_RADIUS_VALUE) {
209 209
 // 			The maximum allowed radius is 50 000 meters.
210
-			throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must be lower than ' . Util::MAX_PLACE_RADIUS_VALUE);
211
-		}
212
-
213
-		return $this->makeApiCall($params, PlaceServicesEndpoints::NEARBYSEARCH);
214
-	}
215
-
216
-	/**
217
-	 * Nearby Search requests
218
-	 *
219
-	 * @param string     $query
220
-	 * @param array|null $params
221
-	 *
222
-	 * @see     https://developers.google.com/places/web-service/search#TextSearchRequests
223
-	 * @return GoogleMapsResultsCollection
224
-	 * @throws InvalidArgumentException
225
-	 * @since   0.5.0
226
-	 */
227
-	public function textSearch(string $query, ?array $params = []): GoogleMapsResultsCollection
228
-	{
229
-
230
-		$params = array_merge($params, [
231
-			GoogleMapsRequestFields::QUERY => $query
232
-		]);
233
-
234
-		return $this->makeApiCall($params, PlaceServicesEndpoints::TEXTSEARCH);
235
-	}
210
+            throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must be lower than ' . Util::MAX_PLACE_RADIUS_VALUE);
211
+        }
212
+
213
+        return $this->makeApiCall($params, PlaceServicesEndpoints::NEARBYSEARCH);
214
+    }
215
+
216
+    /**
217
+     * Nearby Search requests
218
+     *
219
+     * @param string     $query
220
+     * @param array|null $params
221
+     *
222
+     * @see     https://developers.google.com/places/web-service/search#TextSearchRequests
223
+     * @return GoogleMapsResultsCollection
224
+     * @throws InvalidArgumentException
225
+     * @since   0.5.0
226
+     */
227
+    public function textSearch(string $query, ?array $params = []): GoogleMapsResultsCollection
228
+    {
229
+
230
+        $params = array_merge($params, [
231
+            GoogleMapsRequestFields::QUERY => $query
232
+        ]);
233
+
234
+        return $this->makeApiCall($params, PlaceServicesEndpoints::TEXTSEARCH);
235
+    }
236 236
 
237 237
 }
238 238
\ No newline at end of file
Please login to merge, or discard this patch.
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);
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 		if (!empty($params[GoogleMapsRequestFields::LOCATION])) {//-33.8670522,151.1957362
180 180
 			$location = $params[GoogleMapsRequestFields::LOCATION];
181 181
 			if (!$location instanceof Location) {
182
-				throw new InvalidArgumentException(GoogleMapsRequestFields::LOCATION . ' field must be instance of ' . Location::class . ' class');
182
+				throw new InvalidArgumentException(GoogleMapsRequestFields::LOCATION.' field must be instance of '.Location::class.' class');
183 183
 			}
184
-			$params[GoogleMapsRequestFields::LOCATION] = (string)$params[GoogleMapsRequestFields::LOCATION];
184
+			$params[GoogleMapsRequestFields::LOCATION] = (string) $params[GoogleMapsRequestFields::LOCATION];
185 185
 		} else {
186
-			throw new InvalidArgumentException(GoogleMapsResultFields::LOCATION . ' field is required');
186
+			throw new InvalidArgumentException(GoogleMapsResultFields::LOCATION.' field is required');
187 187
 		}
188 188
 
189 189
 		if (!empty($params[GoogleMapsRequestFields::RANKBY]) &&
@@ -194,20 +194,20 @@  discard block
 block discarded – undo
194 194
 				empty($params[GoogleMapsRequestFields::TYPE])) {
195 195
 //				If rankby=distance (described under Optional parameters below) is specified,
196 196
 // 				then one or more of keyword, name, or type is required.
197
-				throw new InvalidArgumentException('If ' . GoogleMapsRequestFields::RANKBY . ' is set as "' . RankByValues::DISTANCE . '" one or more of ' . GoogleMapsRequestFields::KEYWORD . ', ' . GoogleMapsRequestFields::NAME . ', ' . GoogleMapsRequestFields::TYPE . ' fields are required');
197
+				throw new InvalidArgumentException('If '.GoogleMapsRequestFields::RANKBY.' is set as "'.RankByValues::DISTANCE.'" one or more of '.GoogleMapsRequestFields::KEYWORD.', '.GoogleMapsRequestFields::NAME.', '.GoogleMapsRequestFields::TYPE.' fields are required');
198 198
 			}
199 199
 			if (!empty($params[GoogleMapsRequestFields::RADIUS])) {
200 200
 // 				Note that radius must not be included if rankby=distance (described under Optional parameters below) is specified.
201
-				throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must not be included if ' . GoogleMapsRequestFields::RANKBY . ' = ' . RankByValues::DISTANCE);
201
+				throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS.' must not be included if '.GoogleMapsRequestFields::RANKBY.' = '.RankByValues::DISTANCE);
202 202
 			}
203 203
 		} elseif (empty($params[GoogleMapsRequestFields::RADIUS])) {
204 204
 //			radius — Defines the distance (in meters) within which to return place results.
205
-			throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' field is required');
205
+			throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS.' field is required');
206 206
 		}
207 207
 
208 208
 		if (!empty($params[GoogleMapsRequestFields::RADIUS]) && floatval($params[GoogleMapsRequestFields::RADIUS]) > Util::MAX_PLACE_RADIUS_VALUE) {
209 209
 // 			The maximum allowed radius is 50 000 meters.
210
-			throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS . ' must be lower than ' . Util::MAX_PLACE_RADIUS_VALUE);
210
+			throw new InvalidArgumentException(GoogleMapsRequestFields::RADIUS.' must be lower than '.Util::MAX_PLACE_RADIUS_VALUE);
211 211
 		}
212 212
 
213 213
 		return $this->makeApiCall($params, PlaceServicesEndpoints::NEARBYSEARCH);
Please login to merge, or discard this patch.