GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Push — master ( 5f270e...733b13 )
by Igor
09:47 queued 13s
created
src/Route4Me/CustomNoteTypeResponse.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -6,42 +6,42 @@
 block discarded – undo
6 6
 
7 7
 class CustomNoteTypeResponse extends Common
8 8
 {
9
-    /**
10
-     * Note custom type ID
11
-     * @var integer
12
-     */
13
-    public $note_custom_type_id;
14
-
15
-    /**
16
-     * Note custom type
17
-     * @var CustomNoteType
18
-     */
19
-    public $note_custom_type;
20
-
21
-    /**
22
-     * ID of a root owner of the account
23
-     * @var integer
24
-     */
25
-    public $root_owner_member_id;
26
-
27
-    /**
28
-     * Values of the custom note type
29
-     * @var array
30
-     */
31
-    public $note_custom_type_values=[];
32
-
33
-    public static function fromArray(array $params)
34
-    {
35
-        $customNoteTypeResponse = new self();
36
-
37
-        foreach ($params as $key => $value) {
38
-            if (property_exists($customNoteTypeResponse, $key)) {
39
-                $customNoteTypeResponse->{$key} = $value;
40
-            } else {
41
-                throw new BadParam("Correct parameter must be provided. Wrong Parameter: $key");
42
-            }
43
-        }
44
-
45
-        return $customNoteTypeResponse;
46
-    }
9
+	/**
10
+	 * Note custom type ID
11
+	 * @var integer
12
+	 */
13
+	public $note_custom_type_id;
14
+
15
+	/**
16
+	 * Note custom type
17
+	 * @var CustomNoteType
18
+	 */
19
+	public $note_custom_type;
20
+
21
+	/**
22
+	 * ID of a root owner of the account
23
+	 * @var integer
24
+	 */
25
+	public $root_owner_member_id;
26
+
27
+	/**
28
+	 * Values of the custom note type
29
+	 * @var array
30
+	 */
31
+	public $note_custom_type_values=[];
32
+
33
+	public static function fromArray(array $params)
34
+	{
35
+		$customNoteTypeResponse = new self();
36
+
37
+		foreach ($params as $key => $value) {
38
+			if (property_exists($customNoteTypeResponse, $key)) {
39
+				$customNoteTypeResponse->{$key} = $value;
40
+			} else {
41
+				throw new BadParam("Correct parameter must be provided. Wrong Parameter: $key");
42
+			}
43
+		}
44
+
45
+		return $customNoteTypeResponse;
46
+	}
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/GeocodingResponse.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -10,52 +10,52 @@
 block discarded – undo
10 10
  */
11 11
 class GeocodingResponse extends Common
12 12
 {
13
-    /**
14
-     * A geocoded address
15
-     * @var string
16
-     */
17
-    public $address;
18
-
19
-    /**
20
-     * Latitude
21
-     * @var double
22
-     */
23
-    public $lat;
24
-
25
-    /**
26
-     * Longitude
27
-     * @var double
28
-     */
29
-    public $lng;
30
-
31
-    /**
32
-     * Geocoded area level type
33
-     * @var string
34
-     */
35
-    public $type;
36
-
37
-    /**
38
-     * Confidence ("high", "medium", "low")
39
-     * @var string
40
-     */
41
-    public $confidence;
42
-
43
-    /**
44
-     * Content of the original string (an address or geopoint) sent by HTTP
45
-     * @var Route
46
-     */
47
-    public $original;
48
-
49
-    public static function fromArray(array $params)
50
-    {
51
-        $geocodingResponse = new self();
52
-
53
-        foreach ($params as $key => $value) {
54
-            if (property_exists($geocodingResponse, $key)) {
55
-                $geocodingResponse->{$key} = $value;
56
-            }
57
-        }
58
-
59
-        return $geocodingResponse;
60
-    }
13
+	/**
14
+	 * A geocoded address
15
+	 * @var string
16
+	 */
17
+	public $address;
18
+
19
+	/**
20
+	 * Latitude
21
+	 * @var double
22
+	 */
23
+	public $lat;
24
+
25
+	/**
26
+	 * Longitude
27
+	 * @var double
28
+	 */
29
+	public $lng;
30
+
31
+	/**
32
+	 * Geocoded area level type
33
+	 * @var string
34
+	 */
35
+	public $type;
36
+
37
+	/**
38
+	 * Confidence ("high", "medium", "low")
39
+	 * @var string
40
+	 */
41
+	public $confidence;
42
+
43
+	/**
44
+	 * Content of the original string (an address or geopoint) sent by HTTP
45
+	 * @var Route
46
+	 */
47
+	public $original;
48
+
49
+	public static function fromArray(array $params)
50
+	{
51
+		$geocodingResponse = new self();
52
+
53
+		foreach ($params as $key => $value) {
54
+			if (property_exists($geocodingResponse, $key)) {
55
+				$geocodingResponse->{$key} = $value;
56
+			}
57
+		}
58
+
59
+		return $geocodingResponse;
60
+	}
61 61
 }
Please login to merge, or discard this patch.
src/Route4Me/AddressNote.php 1 patch
Indentation   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -11,238 +11,238 @@
 block discarded – undo
11 11
  */
12 12
 class AddressNote extends Common
13 13
 {
14
-    /**
15
-     * An unique ID of a note
16
-     * @var integer
17
-     */
18
-    public $note_id;
19
-
20
-    /**
21
-     * The route ID
22
-     * @var string
23
-     */
24
-    public $route_id;
25
-
26
-    /**
27
-     * The route destination ID
28
-     * @var integer
29
-     */
30
-    public $route_destination_id;
31
-
32
-    /**
33
-     * An unique ID of an uploaded file
34
-     * @var string
35
-     */
36
-    public $upload_id;
37
-
38
-    /**
39
-     * When the note was added
40
-     * @var integer
41
-     */
42
-    public $ts_added;
43
-
44
-    /**
45
-     * The position latitude where the address note was added
46
-     * @var double
47
-     */
48
-    public $lat;
49
-
50
-    /**
51
-     * The position longitude where the address note was added
52
-     * @var double
53
-     */
54
-    public $lng;
55
-
56
-    /**
57
-     * The activity type
58
-     * @var string
59
-     */
60
-    public $activity_type;
61
-
62
-    /**
63
-     * The note text contents
64
-     * @var string
65
-     */
66
-    public $contents;
67
-
68
-    /**
69
-     * An upload type of the note
70
-     * @var string
71
-     */
72
-    public $upload_type;
73
-
74
-    /**
75
-     * An upload url - where a file-note was uploaded.
76
-     * @var string
77
-     */
78
-    public $upload_url;
79
-
80
-    /**
81
-     * An extension of the uploaded file.
82
-     * @var string
83
-     */
84
-    public $upload_extension;
85
-
86
-    /**
87
-     * The device a note was uploaded from.
88
-     * @var string
89
-     */
90
-    public $device_type;
91
-
92
-    /**
93
-     * Array of the custom type notes.
94
-     * @var CustomNoteType[]
95
-     */
96
-    public $custom_types;
97
-
98
-    public function __construct()
99
-    {
100
-
101
-    }
102
-
103
-    public static function fromArray(array $params)
104
-    {
105
-        $addressNote = new self();
106
-
107
-        foreach ($params as $key => $value) {
108
-            if (property_exists($addressNote, $key)) {
109
-                $addressNote->{$key} = $value;
110
-            } else {
111
-                throw new BadParam("Correct parameter must be provided. Wrong Parameter: $key");
112
-            }
113
-        }
114
-
115
-        return $addressNote;
116
-    }
117
-
118
-    /**
119
-     * Get notes from the specified route destination.<br>
120
-     * Returns an address object with notes, if an address exists, otherwise - return null.
121
-     */
122
-    public static function GetAddressesNotes($noteParams)
123
-    {
124
-        $address = Route4Me::makeRequst([
125
-            'url'       => Endpoint::ADDRESS_V4,
126
-            'method'    => 'GET',
127
-            'query'     => [
128
-                'route_id'              => isset($noteParams['route_id']) ? $noteParams['route_id'] : null,
129
-                'route_destination_id'  => isset($noteParams['route_destination_id'])
130
-                    ? $noteParams['route_destination_id'] : null,
131
-                'notes' => 1,
132
-            ],
133
-        ]);
134
-
135
-        return $address;
136
-    }
137
-
138
-    public function createCustomNoteType($params)
139
-    {
140
-        $allBodyFields = ['type', 'values'];
141
-
142
-        $result = Route4Me::makeRequst([
143
-            'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
144
-            'method'    => 'POST',
145
-            'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
146
-        ]);
147
-
148
-        return $result;
149
-    }
150
-
151
-    public function removeCustomNoteType($params)
152
-    {
153
-        $result = Route4Me::makeRequst([
154
-            'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
155
-            'method'    => 'DELETE',
156
-            'body'      => [
157
-                'id' => isset($params['id']) ? $params['id'] : null,
158
-            ],
159
-        ]);
160
-
161
-        return $result;
162
-    }
163
-
164
-    public function getAllCustomNoteTypes()
165
-    {
166
-        $result = Route4Me::makeRequst([
167
-            'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
168
-            'method'    => 'GET',
169
-        ]);
170
-
171
-        return $result;
172
-    }
173
-
174
-    public function getCustomNoteTypeByKey($params)
175
-    {
176
-        $result = Route4Me::makeRequst([
177
-            'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
178
-            'method'    => 'GET',
179
-        ]);
180
-
181
-        if (is_null($result) || !is_array($result)) return null;
182
-
183
-        foreach ($result as $custNoteType) {
184
-            if (isset($custNoteType["note_custom_type"]) && $custNoteType["note_custom_type"] == $params) {
185
-                return $custNoteType;
186
-            }
187
-        }
188
-    }
189
-
190
-    public function AddAddressNote($params)
191
-    {
192
-        $allQueryFields = ['route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type'];
193
-        $allBodyFields = ['strNoteContents', 'strUpdateType'];
194
-
195
-        $result = Route4Me::makeRequst([
196
-            'url'           => Endpoint::ROUTE_NOTES_ADD,
197
-            'method'        => 'POST',
198
-            'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
199
-            'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
200
-            'HTTPHEADER'    => 'Content-Type: multipart/form-data',
201
-        ]);
202
-
203
-        return $result;
204
-    }
205
-
206
-    public function AddNoteFile($params)
207
-    {
208
-        $fname = isset($params['strFilename']) ? $params['strFilename'] : null;
209
-
210
-        $allQueryFields = ['route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type'];
211
-        $allBodyFields = ['strFilename', 'strUpdateType', 'strNoteContents'];
212
-
213
-        $result = Route4Me::makeRequst([
214
-            'url'           => Endpoint::ROUTE_NOTES_ADD,
215
-            'method'        => 'POST',
216
-            'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
217
-            'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
218
-            'FILE'          => $fname,
219
-            'HTTPHEADER'    => 'Content-Type: multipart/form-data'
220
-        ]);
221
-
222
-        return $result;
223
-    }
224
-
225
-    public function addCustomNoteToRoute($params)
226
-    {
227
-        $customArray = [];
228
-
229
-        foreach ($params as $key => $value) {
230
-            if (false !== strpos($key, 'custom_note_type')) {
231
-                $customArray[$key] = $value;
232
-            }
233
-        }
234
-
235
-        $allQueryFields = ['route_id', 'address_id', 'format', 'dev_lat', 'dev_lng'];
236
-        $allBodyFields = ['strUpdateType', 'strUpdateType', 'strNoteContents'];
237
-
238
-        $result = Route4Me::makeRequst([
239
-            'url'           => Endpoint::ROUTE_NOTES_ADD,
240
-            'method'        => 'POST',
241
-            'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
242
-            'body'          => array_merge(Route4Me::generateRequestParameters($allBodyFields, $params), $customArray),
243
-            'HTTPHEADER'    => 'Content-Type: multipart/form-data',
244
-        ]);
245
-
246
-        return $result;
247
-    }
14
+	/**
15
+	 * An unique ID of a note
16
+	 * @var integer
17
+	 */
18
+	public $note_id;
19
+
20
+	/**
21
+	 * The route ID
22
+	 * @var string
23
+	 */
24
+	public $route_id;
25
+
26
+	/**
27
+	 * The route destination ID
28
+	 * @var integer
29
+	 */
30
+	public $route_destination_id;
31
+
32
+	/**
33
+	 * An unique ID of an uploaded file
34
+	 * @var string
35
+	 */
36
+	public $upload_id;
37
+
38
+	/**
39
+	 * When the note was added
40
+	 * @var integer
41
+	 */
42
+	public $ts_added;
43
+
44
+	/**
45
+	 * The position latitude where the address note was added
46
+	 * @var double
47
+	 */
48
+	public $lat;
49
+
50
+	/**
51
+	 * The position longitude where the address note was added
52
+	 * @var double
53
+	 */
54
+	public $lng;
55
+
56
+	/**
57
+	 * The activity type
58
+	 * @var string
59
+	 */
60
+	public $activity_type;
61
+
62
+	/**
63
+	 * The note text contents
64
+	 * @var string
65
+	 */
66
+	public $contents;
67
+
68
+	/**
69
+	 * An upload type of the note
70
+	 * @var string
71
+	 */
72
+	public $upload_type;
73
+
74
+	/**
75
+	 * An upload url - where a file-note was uploaded.
76
+	 * @var string
77
+	 */
78
+	public $upload_url;
79
+
80
+	/**
81
+	 * An extension of the uploaded file.
82
+	 * @var string
83
+	 */
84
+	public $upload_extension;
85
+
86
+	/**
87
+	 * The device a note was uploaded from.
88
+	 * @var string
89
+	 */
90
+	public $device_type;
91
+
92
+	/**
93
+	 * Array of the custom type notes.
94
+	 * @var CustomNoteType[]
95
+	 */
96
+	public $custom_types;
97
+
98
+	public function __construct()
99
+	{
100
+
101
+	}
102
+
103
+	public static function fromArray(array $params)
104
+	{
105
+		$addressNote = new self();
106
+
107
+		foreach ($params as $key => $value) {
108
+			if (property_exists($addressNote, $key)) {
109
+				$addressNote->{$key} = $value;
110
+			} else {
111
+				throw new BadParam("Correct parameter must be provided. Wrong Parameter: $key");
112
+			}
113
+		}
114
+
115
+		return $addressNote;
116
+	}
117
+
118
+	/**
119
+	 * Get notes from the specified route destination.<br>
120
+	 * Returns an address object with notes, if an address exists, otherwise - return null.
121
+	 */
122
+	public static function GetAddressesNotes($noteParams)
123
+	{
124
+		$address = Route4Me::makeRequst([
125
+			'url'       => Endpoint::ADDRESS_V4,
126
+			'method'    => 'GET',
127
+			'query'     => [
128
+				'route_id'              => isset($noteParams['route_id']) ? $noteParams['route_id'] : null,
129
+				'route_destination_id'  => isset($noteParams['route_destination_id'])
130
+					? $noteParams['route_destination_id'] : null,
131
+				'notes' => 1,
132
+			],
133
+		]);
134
+
135
+		return $address;
136
+	}
137
+
138
+	public function createCustomNoteType($params)
139
+	{
140
+		$allBodyFields = ['type', 'values'];
141
+
142
+		$result = Route4Me::makeRequst([
143
+			'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
144
+			'method'    => 'POST',
145
+			'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
146
+		]);
147
+
148
+		return $result;
149
+	}
150
+
151
+	public function removeCustomNoteType($params)
152
+	{
153
+		$result = Route4Me::makeRequst([
154
+			'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
155
+			'method'    => 'DELETE',
156
+			'body'      => [
157
+				'id' => isset($params['id']) ? $params['id'] : null,
158
+			],
159
+		]);
160
+
161
+		return $result;
162
+	}
163
+
164
+	public function getAllCustomNoteTypes()
165
+	{
166
+		$result = Route4Me::makeRequst([
167
+			'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
168
+			'method'    => 'GET',
169
+		]);
170
+
171
+		return $result;
172
+	}
173
+
174
+	public function getCustomNoteTypeByKey($params)
175
+	{
176
+		$result = Route4Me::makeRequst([
177
+			'url'       => Endpoint::NOTE_CUSTOM_TYPES_V4,
178
+			'method'    => 'GET',
179
+		]);
180
+
181
+		if (is_null($result) || !is_array($result)) return null;
182
+
183
+		foreach ($result as $custNoteType) {
184
+			if (isset($custNoteType["note_custom_type"]) && $custNoteType["note_custom_type"] == $params) {
185
+				return $custNoteType;
186
+			}
187
+		}
188
+	}
189
+
190
+	public function AddAddressNote($params)
191
+	{
192
+		$allQueryFields = ['route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type'];
193
+		$allBodyFields = ['strNoteContents', 'strUpdateType'];
194
+
195
+		$result = Route4Me::makeRequst([
196
+			'url'           => Endpoint::ROUTE_NOTES_ADD,
197
+			'method'        => 'POST',
198
+			'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
199
+			'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
200
+			'HTTPHEADER'    => 'Content-Type: multipart/form-data',
201
+		]);
202
+
203
+		return $result;
204
+	}
205
+
206
+	public function AddNoteFile($params)
207
+	{
208
+		$fname = isset($params['strFilename']) ? $params['strFilename'] : null;
209
+
210
+		$allQueryFields = ['route_id', 'address_id', 'dev_lat', 'dev_lng', 'device_type'];
211
+		$allBodyFields = ['strFilename', 'strUpdateType', 'strNoteContents'];
212
+
213
+		$result = Route4Me::makeRequst([
214
+			'url'           => Endpoint::ROUTE_NOTES_ADD,
215
+			'method'        => 'POST',
216
+			'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
217
+			'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
218
+			'FILE'          => $fname,
219
+			'HTTPHEADER'    => 'Content-Type: multipart/form-data'
220
+		]);
221
+
222
+		return $result;
223
+	}
224
+
225
+	public function addCustomNoteToRoute($params)
226
+	{
227
+		$customArray = [];
228
+
229
+		foreach ($params as $key => $value) {
230
+			if (false !== strpos($key, 'custom_note_type')) {
231
+				$customArray[$key] = $value;
232
+			}
233
+		}
234
+
235
+		$allQueryFields = ['route_id', 'address_id', 'format', 'dev_lat', 'dev_lng'];
236
+		$allBodyFields = ['strUpdateType', 'strUpdateType', 'strNoteContents'];
237
+
238
+		$result = Route4Me::makeRequst([
239
+			'url'           => Endpoint::ROUTE_NOTES_ADD,
240
+			'method'        => 'POST',
241
+			'query'         => Route4Me::generateRequestParameters($allQueryFields, $params),
242
+			'body'          => array_merge(Route4Me::generateRequestParameters($allBodyFields, $params), $customArray),
243
+			'HTTPHEADER'    => 'Content-Type: multipart/form-data',
244
+		]);
245
+
246
+		return $result;
247
+	}
248 248
 }
Please login to merge, or discard this patch.
src/Route4Me/Territory.php 1 patch
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -7,110 +7,110 @@
 block discarded – undo
7 7
 
8 8
 class Territory extends Common
9 9
 {
10
-    /**
11
-     * @var
12
-     */
13
-    public $territory_id; // Territory id
14
-    public $territory_name;
15
-    public $territory_color;
16
-    public $addresses;
17
-    public $member_id;
18
-    public $territory; // Territory parameters
19
-
20
-    public function __construct()
21
-    {
22
-        Route4Me::setBaseUrl(Endpoint::BASE_URL);
23
-    }
24
-
25
-    public static function fromArray(array $params)
26
-    {
27
-        if (!isset($params['territory_name'])) {
28
-            throw new BadParam('Territory name must be provided');
29
-        }
30
-
31
-        if (!isset($params['territory_color'])) {
32
-            throw new BadParam('Territory color must be provided');
33
-        }
34
-
35
-        if (!isset($params['territory'])) {
36
-            throw new BadParam('Territory must be provided');
37
-        }
38
-
39
-        $territoryparameters = new self();
40
-
41
-        foreach ($params as $key => $value) {
42
-            if (property_exists($territoryparameters, $key)) {
43
-                $territoryparameters->{$key} = $value;
44
-            }
45
-        }
46
-
47
-        return $territoryparameters;
48
-    }
49
-
50
-    public static function getTerritory($params)
51
-    {
52
-        $allQueryFields = ['territory_id', 'addresses'];
53
-
54
-        $territory = Route4Me::makeRequst([
55
-            'url'       => Endpoint::TERRITORY_V4,
56
-            'method'    => 'GET',
57
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
58
-        ]);
59
-
60
-        return $territory;
61
-    }
62
-
63
-    public static function getTerritories($params)
64
-    {
65
-        $allQueryFields = ['offset', 'limit', 'addresses'];
66
-
67
-        $response = Route4Me::makeRequst([
68
-            'url'       => Endpoint::TERRITORY_V4,
69
-            'method'    => 'GET',
70
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
71
-        ]);
72
-
73
-        return $response;
74
-    }
75
-
76
-    public static function addTerritory($params)
77
-    {
78
-        $allBodyFields = ['territory_name', 'member_id', 'territory_color', 'territory'];
79
-
80
-        $response = Route4Me::makeRequst([
81
-            'url'       => Endpoint::TERRITORY_V4,
82
-            'method'    => 'POST',
83
-            'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
84
-        ]);
85
-
86
-        return $response;
87
-    }
88
-
89
-    public function deleteTerritory($territory_id)
90
-    {
91
-        $result = Route4Me::makeRequst([
92
-            'url'       => Endpoint::TERRITORY_V4,
93
-            'method'    => 'DELETE',
94
-            'query'     => [
95
-                'territory_id' => $territory_id,
96
-            ],
97
-        ]);
98
-
99
-        return $result;
100
-    }
101
-
102
-    public function updateTerritory($params)
103
-    {
104
-        $allQueryFields = ['territory_id'];
105
-        $allBodyFields = ['territory_name', 'member_id', 'territory_color', 'territory'];
106
-
107
-        $response = Route4Me::makeRequst([
108
-            'url'       => Endpoint::TERRITORY_V4,
109
-            'method'    => 'PUT',
110
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
111
-            'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
112
-        ]);
113
-
114
-        return $response;
115
-    }
10
+	/**
11
+	 * @var
12
+	 */
13
+	public $territory_id; // Territory id
14
+	public $territory_name;
15
+	public $territory_color;
16
+	public $addresses;
17
+	public $member_id;
18
+	public $territory; // Territory parameters
19
+
20
+	public function __construct()
21
+	{
22
+		Route4Me::setBaseUrl(Endpoint::BASE_URL);
23
+	}
24
+
25
+	public static function fromArray(array $params)
26
+	{
27
+		if (!isset($params['territory_name'])) {
28
+			throw new BadParam('Territory name must be provided');
29
+		}
30
+
31
+		if (!isset($params['territory_color'])) {
32
+			throw new BadParam('Territory color must be provided');
33
+		}
34
+
35
+		if (!isset($params['territory'])) {
36
+			throw new BadParam('Territory must be provided');
37
+		}
38
+
39
+		$territoryparameters = new self();
40
+
41
+		foreach ($params as $key => $value) {
42
+			if (property_exists($territoryparameters, $key)) {
43
+				$territoryparameters->{$key} = $value;
44
+			}
45
+		}
46
+
47
+		return $territoryparameters;
48
+	}
49
+
50
+	public static function getTerritory($params)
51
+	{
52
+		$allQueryFields = ['territory_id', 'addresses'];
53
+
54
+		$territory = Route4Me::makeRequst([
55
+			'url'       => Endpoint::TERRITORY_V4,
56
+			'method'    => 'GET',
57
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
58
+		]);
59
+
60
+		return $territory;
61
+	}
62
+
63
+	public static function getTerritories($params)
64
+	{
65
+		$allQueryFields = ['offset', 'limit', 'addresses'];
66
+
67
+		$response = Route4Me::makeRequst([
68
+			'url'       => Endpoint::TERRITORY_V4,
69
+			'method'    => 'GET',
70
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
71
+		]);
72
+
73
+		return $response;
74
+	}
75
+
76
+	public static function addTerritory($params)
77
+	{
78
+		$allBodyFields = ['territory_name', 'member_id', 'territory_color', 'territory'];
79
+
80
+		$response = Route4Me::makeRequst([
81
+			'url'       => Endpoint::TERRITORY_V4,
82
+			'method'    => 'POST',
83
+			'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
84
+		]);
85
+
86
+		return $response;
87
+	}
88
+
89
+	public function deleteTerritory($territory_id)
90
+	{
91
+		$result = Route4Me::makeRequst([
92
+			'url'       => Endpoint::TERRITORY_V4,
93
+			'method'    => 'DELETE',
94
+			'query'     => [
95
+				'territory_id' => $territory_id,
96
+			],
97
+		]);
98
+
99
+		return $result;
100
+	}
101
+
102
+	public function updateTerritory($params)
103
+	{
104
+		$allQueryFields = ['territory_id'];
105
+		$allBodyFields = ['territory_name', 'member_id', 'territory_color', 'territory'];
106
+
107
+		$response = Route4Me::makeRequst([
108
+			'url'       => Endpoint::TERRITORY_V4,
109
+			'method'    => 'PUT',
110
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
111
+			'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
112
+		]);
113
+
114
+		return $response;
115
+	}
116 116
 }
Please login to merge, or discard this patch.
src/Route4Me/MyQ.php 1 patch
Indentation   +210 added lines, -210 removed lines patch added patch discarded remove patch
@@ -13,214 +13,214 @@
 block discarded – undo
13 13
 
14 14
 class MyQ
15 15
 {
16
-    /** @var string|null $username contains the username used to authenticate with the MyQ API */
17
-    protected $username = null;
18
-    /** @var string|null $password contains the password used to authenticate with the MyQ API */
19
-    protected $password = null;
20
-    /** @var string|null $appId is the application ID used to register with the MyQ API */
21
-    protected $appId = 'NWknvuBd7LoFHfXmKNMBcgajXtZEgKUh4V7WNzMidrpUUluDpVYVZx+xT4PCM5Kx';
22
-    //protected $appId = 'Vj8pQggXLhLy0WHahglCD4N1nAkkXQtGYpq2HrHD7H1nvmbT55KqtN6RSF4ILB%2fi';
23
-    /** @var string|null $securityToken is the auth token returned after a successful login */
24
-    protected $securityToken = null;
25
-    /** @var string|null $userAgent is the User-Agent header value sent with each API request */
26
-    protected $userAgent = 'Chamberlain/3.4.1';
27
-    /** @var string|null $culture is the API culture code for the API */
28
-    protected $culture = 'en';
29
-    /** @var string|null $contentType is the content type used for all cURL requests */
30
-    protected $contentType = 'application/json';
31
-    /** @var array $headers contain HTTP headers for cURL requests */
32
-    protected $_headers = [];
33
-    protected $_deviceId = null;
34
-    protected $_locationName = null;
35
-    protected $_doorName = null;
36
-    protected $_loginUrl = 'https://myqexternal.myqdevice.com/api/v4/User/Validate';
37
-    protected $_getDeviceDetailUrl = 'https://myqexternal.myqdevice.com/api/v4/userdevicedetails/get?&filterOn=true';
38
-    protected $_putDeviceStateUrl = '/api/v4/DeviceAttribute/PutDeviceAttribute';
39
-    /** @var resource|null $_conn is the web connection to the MyQ API */
40
-    protected $_conn = null;
41
-
42
-    /**
43
-     * Initializes class. Optionally allows user to override variables.
44
-     *
45
-     * @param array $params A associative array for overwriting class variables
46
-     *
47
-     * @return MyQ
48
-     */
49
-    public function __construct($params = [])
50
-    {
51
-        // Overwrite class variables
52
-        foreach ($params as $k => $v) {
53
-            $this->$k = $v;
54
-        }
55
-
56
-        // Initialize cURL request headers
57
-        if (0 == sizeof($this->_headers)) {
58
-            $this->_headers = [
59
-                'MyQApplicationId' => $this->appId,
60
-                'Culture' => $this->culture,
61
-                'Content-Type' => $this->contentType,
62
-                'User-Agent' => $this->userAgent,
63
-            ];
64
-        }
65
-
66
-        // Initialize cURL connection
67
-        $this->_init();
68
-
69
-        return $this;
70
-    }
71
-
72
-    /**
73
-     * Perform a login request.
74
-     *
75
-     * @param string|null $username Username to use when logging in
76
-     * @param string|null $password Password to use for logging in
77
-     *
78
-     * @return MyQ
79
-     */
80
-    public function login($username = null, $password = null)
81
-    {
82
-        // Set username/password if not null
83
-        if (!is_null($username)) {
84
-            $this->username = $username;
85
-        }
86
-
87
-        if (!is_null($password)) {
88
-            $this->password = $password;
89
-        }
90
-
91
-        // confirm that we have a valid username/password
92
-        $error = [];
93
-        if (is_null($this->username)) {
94
-            $error[] = 'username';
95
-        }
96
-
97
-        if (is_null($this->password)) {
98
-            $error[] = 'password';
99
-        }
100
-
101
-        if (sizeof($error) > 0) {
102
-            throw new MyQException('Missing required auth credential: '.implode(',', $error));
103
-        }
104
-
105
-        $this->_login();
106
-    }
107
-
108
-    public function getState()
109
-    {
110
-        $this->_getDetails();
111
-        $timeInState = time() - $this->_doorStateTime;
112
-        echo implode(',', [
113
-            $this->_locationName,
114
-            $this->_doorName,
115
-            $this->_doorState,
116
-            (int) $timeInState,
117
-        ]);
118
-    }
119
-
120
-    public function getDetails()
121
-    {
122
-        return $this->_getDetails();
123
-    }
124
-
125
-    private function _init()
126
-    {
127
-        if (!isset($this->_conn)) {
128
-            $this->_conn = curl_init();
129
-
130
-            curl_setopt_array($this->_conn, [
131
-                CURLOPT_RETURNTRANSFER => true,
132
-                CURLOPT_ENCODING => '',
133
-                CURLOPT_MAXREDIRS => 10,
134
-                CURLOPT_TIMEOUT => 30,
135
-                CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
136
-                CURLOPT_FAILONERROR => true,
137
-                CURLOPT_FOLLOWLOCATION => true,
138
-                CURLOPT_FRESH_CONNECT => true,
139
-                CURLOPT_FORBID_REUSE => true,
140
-                CURLOPT_USERAGENT => $this->userAgent,
141
-            ]);
142
-        }
143
-
144
-        $this->_setHeaders();
145
-    }
146
-
147
-    private function _setHeaders()
148
-    {
149
-        $headers = [];
150
-
151
-        foreach ($this->_headers as $k => $v) {
152
-            $headers[] = "$k: $v";
153
-        }
154
-
155
-        curl_setopt($this->_conn, CURLOPT_HTTPHEADER, $headers);
156
-    }
157
-
158
-    private function _login()
159
-    {
160
-        $this->_init();
161
-
162
-        curl_setopt($this->_conn, CURLOPT_CUSTOMREQUEST, 'POST');
163
-        curl_setopt($this->_conn, CURLOPT_URL, $this->_loginUrl);
164
-
165
-        $post = json_encode(['username' => $this->username, 'password' => $this->password]);
166
-
167
-        curl_setopt($this->_conn, CURLOPT_POSTFIELDS, $post);
168
-
169
-        $output = curl_exec($this->_conn);
170
-
171
-        $data = json_decode($output);
172
-
173
-        if (false == $data || !isset($data->SecurityToken)) {
174
-            throw new MyQException("Error processing login request: $output");
175
-        }
176
-
177
-        $this->_headers['SecurityToken'] = $data->SecurityToken;
178
-
179
-        return $this;
180
-    }
181
-
182
-    private function _getDetails()
183
-    {
184
-        $this->_init();
185
-
186
-        curl_setopt($this->_conn, CURLOPT_CUSTOMREQUEST, 'GET');
187
-        curl_setopt($this->_conn, CURLOPT_URL, $this->_getDeviceDetailUrl);
188
-
189
-        $output = curl_exec($this->_conn);
190
-
191
-        $data = json_decode($output);
192
-
193
-        if (false == $data || !isset($data->Devices)) {
194
-            throw new MyQException("Error fetching device details: $output");
195
-        }
196
-
197
-        // Find our door device ID
198
-        foreach ($data->Devices as $device) {
199
-            if (false !== stripos($device->MyQDeviceTypeName, 'Gateway')) {
200
-                // Find location name
201
-                foreach ($device->Attributes as $attr) {
202
-                    if ('desc' == $attr->AttributeDisplayName) {
203
-                        $this->_locationName = $attr->Value;
204
-                    }
205
-                }
206
-            }
207
-
208
-            $this->_deviceId = $device->MyQDeviceId;
209
-
210
-            foreach ($device->Attributes as $attr) {
211
-                switch ($attr->AttributeDisplayName) {
212
-                    case 'desc':
213
-                        $this->_doorName = $attr->Value;
214
-                        break;
215
-                    case 'doorstate':
216
-                        $this->_doorState = $attr->Value;
217
-                        // UpdatedTime is a timestamp in ms, so we truncate
218
-                        $this->_doorStateTime = (int) $attr->UpdatedTime / 1000;
219
-                        break;
220
-                    default:
221
-                        continue;
222
-                }
223
-            }
224
-        }
225
-    }
16
+	/** @var string|null $username contains the username used to authenticate with the MyQ API */
17
+	protected $username = null;
18
+	/** @var string|null $password contains the password used to authenticate with the MyQ API */
19
+	protected $password = null;
20
+	/** @var string|null $appId is the application ID used to register with the MyQ API */
21
+	protected $appId = 'NWknvuBd7LoFHfXmKNMBcgajXtZEgKUh4V7WNzMidrpUUluDpVYVZx+xT4PCM5Kx';
22
+	//protected $appId = 'Vj8pQggXLhLy0WHahglCD4N1nAkkXQtGYpq2HrHD7H1nvmbT55KqtN6RSF4ILB%2fi';
23
+	/** @var string|null $securityToken is the auth token returned after a successful login */
24
+	protected $securityToken = null;
25
+	/** @var string|null $userAgent is the User-Agent header value sent with each API request */
26
+	protected $userAgent = 'Chamberlain/3.4.1';
27
+	/** @var string|null $culture is the API culture code for the API */
28
+	protected $culture = 'en';
29
+	/** @var string|null $contentType is the content type used for all cURL requests */
30
+	protected $contentType = 'application/json';
31
+	/** @var array $headers contain HTTP headers for cURL requests */
32
+	protected $_headers = [];
33
+	protected $_deviceId = null;
34
+	protected $_locationName = null;
35
+	protected $_doorName = null;
36
+	protected $_loginUrl = 'https://myqexternal.myqdevice.com/api/v4/User/Validate';
37
+	protected $_getDeviceDetailUrl = 'https://myqexternal.myqdevice.com/api/v4/userdevicedetails/get?&filterOn=true';
38
+	protected $_putDeviceStateUrl = '/api/v4/DeviceAttribute/PutDeviceAttribute';
39
+	/** @var resource|null $_conn is the web connection to the MyQ API */
40
+	protected $_conn = null;
41
+
42
+	/**
43
+	 * Initializes class. Optionally allows user to override variables.
44
+	 *
45
+	 * @param array $params A associative array for overwriting class variables
46
+	 *
47
+	 * @return MyQ
48
+	 */
49
+	public function __construct($params = [])
50
+	{
51
+		// Overwrite class variables
52
+		foreach ($params as $k => $v) {
53
+			$this->$k = $v;
54
+		}
55
+
56
+		// Initialize cURL request headers
57
+		if (0 == sizeof($this->_headers)) {
58
+			$this->_headers = [
59
+				'MyQApplicationId' => $this->appId,
60
+				'Culture' => $this->culture,
61
+				'Content-Type' => $this->contentType,
62
+				'User-Agent' => $this->userAgent,
63
+			];
64
+		}
65
+
66
+		// Initialize cURL connection
67
+		$this->_init();
68
+
69
+		return $this;
70
+	}
71
+
72
+	/**
73
+	 * Perform a login request.
74
+	 *
75
+	 * @param string|null $username Username to use when logging in
76
+	 * @param string|null $password Password to use for logging in
77
+	 *
78
+	 * @return MyQ
79
+	 */
80
+	public function login($username = null, $password = null)
81
+	{
82
+		// Set username/password if not null
83
+		if (!is_null($username)) {
84
+			$this->username = $username;
85
+		}
86
+
87
+		if (!is_null($password)) {
88
+			$this->password = $password;
89
+		}
90
+
91
+		// confirm that we have a valid username/password
92
+		$error = [];
93
+		if (is_null($this->username)) {
94
+			$error[] = 'username';
95
+		}
96
+
97
+		if (is_null($this->password)) {
98
+			$error[] = 'password';
99
+		}
100
+
101
+		if (sizeof($error) > 0) {
102
+			throw new MyQException('Missing required auth credential: '.implode(',', $error));
103
+		}
104
+
105
+		$this->_login();
106
+	}
107
+
108
+	public function getState()
109
+	{
110
+		$this->_getDetails();
111
+		$timeInState = time() - $this->_doorStateTime;
112
+		echo implode(',', [
113
+			$this->_locationName,
114
+			$this->_doorName,
115
+			$this->_doorState,
116
+			(int) $timeInState,
117
+		]);
118
+	}
119
+
120
+	public function getDetails()
121
+	{
122
+		return $this->_getDetails();
123
+	}
124
+
125
+	private function _init()
126
+	{
127
+		if (!isset($this->_conn)) {
128
+			$this->_conn = curl_init();
129
+
130
+			curl_setopt_array($this->_conn, [
131
+				CURLOPT_RETURNTRANSFER => true,
132
+				CURLOPT_ENCODING => '',
133
+				CURLOPT_MAXREDIRS => 10,
134
+				CURLOPT_TIMEOUT => 30,
135
+				CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
136
+				CURLOPT_FAILONERROR => true,
137
+				CURLOPT_FOLLOWLOCATION => true,
138
+				CURLOPT_FRESH_CONNECT => true,
139
+				CURLOPT_FORBID_REUSE => true,
140
+				CURLOPT_USERAGENT => $this->userAgent,
141
+			]);
142
+		}
143
+
144
+		$this->_setHeaders();
145
+	}
146
+
147
+	private function _setHeaders()
148
+	{
149
+		$headers = [];
150
+
151
+		foreach ($this->_headers as $k => $v) {
152
+			$headers[] = "$k: $v";
153
+		}
154
+
155
+		curl_setopt($this->_conn, CURLOPT_HTTPHEADER, $headers);
156
+	}
157
+
158
+	private function _login()
159
+	{
160
+		$this->_init();
161
+
162
+		curl_setopt($this->_conn, CURLOPT_CUSTOMREQUEST, 'POST');
163
+		curl_setopt($this->_conn, CURLOPT_URL, $this->_loginUrl);
164
+
165
+		$post = json_encode(['username' => $this->username, 'password' => $this->password]);
166
+
167
+		curl_setopt($this->_conn, CURLOPT_POSTFIELDS, $post);
168
+
169
+		$output = curl_exec($this->_conn);
170
+
171
+		$data = json_decode($output);
172
+
173
+		if (false == $data || !isset($data->SecurityToken)) {
174
+			throw new MyQException("Error processing login request: $output");
175
+		}
176
+
177
+		$this->_headers['SecurityToken'] = $data->SecurityToken;
178
+
179
+		return $this;
180
+	}
181
+
182
+	private function _getDetails()
183
+	{
184
+		$this->_init();
185
+
186
+		curl_setopt($this->_conn, CURLOPT_CUSTOMREQUEST, 'GET');
187
+		curl_setopt($this->_conn, CURLOPT_URL, $this->_getDeviceDetailUrl);
188
+
189
+		$output = curl_exec($this->_conn);
190
+
191
+		$data = json_decode($output);
192
+
193
+		if (false == $data || !isset($data->Devices)) {
194
+			throw new MyQException("Error fetching device details: $output");
195
+		}
196
+
197
+		// Find our door device ID
198
+		foreach ($data->Devices as $device) {
199
+			if (false !== stripos($device->MyQDeviceTypeName, 'Gateway')) {
200
+				// Find location name
201
+				foreach ($device->Attributes as $attr) {
202
+					if ('desc' == $attr->AttributeDisplayName) {
203
+						$this->_locationName = $attr->Value;
204
+					}
205
+				}
206
+			}
207
+
208
+			$this->_deviceId = $device->MyQDeviceId;
209
+
210
+			foreach ($device->Attributes as $attr) {
211
+				switch ($attr->AttributeDisplayName) {
212
+					case 'desc':
213
+						$this->_doorName = $attr->Value;
214
+						break;
215
+					case 'doorstate':
216
+						$this->_doorState = $attr->Value;
217
+						// UpdatedTime is a timestamp in ms, so we truncate
218
+						$this->_doorStateTime = (int) $attr->UpdatedTime / 1000;
219
+						break;
220
+					default:
221
+						continue;
222
+				}
223
+			}
224
+		}
225
+	}
226 226
 }
Please login to merge, or discard this patch.
src/Route4Me/CurlHttpClient.php 1 patch
Indentation   +419 added lines, -419 removed lines patch added patch discarded remove patch
@@ -4,380 +4,380 @@  discard block
 block discarded – undo
4 4
 
5 5
 class CurlHttpClient
6 6
 {
7
-    public $ch;
8
-    public $debug = false;
9
-    public $error_msg;
10
-
11
-    public function CurlHttpClient($debug = false)
12
-    {
13
-        $this->debug = $debug;
14
-        $this->init();
15
-    }
16
-
17
-    public function init()
18
-    {
19
-        // initialize curl handle
20
-        $this->ch = curl_init();
21
-        //set various options
22
-        //set error in case http return code bigger than 300
23
-        curl_setopt($this->ch, CURLOPT_FAILONERROR, true);
24
-        // use gzip if possible
25
-        curl_setopt($this->ch, CURLOPT_ENCODING, 'gzip, deflate');
26
-        // do not veryfy ssl
27
-        // this is important for windows
28
-        // as well for being able to access pages with non valid cert
29
-        curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
30
-    }
31
-
32
-    /**
33
-     * Set username/pass for basic http auth.
34
-     *
35
-     * @param string user
36
-     * @param string pass
37
-     */
38
-    public function setCredentials($username, $password)
39
-    {
40
-        curl_setopt($this->ch, CURLOPT_USERPWD, "$username:$password");
41
-    }
42
-
43
-    /**
44
-     * Set referrer.
45
-     *
46
-     * @param string referrer url
47
-     */
48
-    public function setReferrer($referrer_url)
49
-    {
50
-        curl_setopt($this->ch, CURLOPT_REFERER, $referrer_url);
51
-    }
52
-
53
-    /**
54
-     * Set client's userAgent.
55
-     *
56
-     * @param string user agent
57
-     */
58
-    public function setUserAgent($userAgent)
59
-    {
60
-        curl_setopt($this->ch, CURLOPT_USERAGENT, $userAgent);
61
-    }
62
-
63
-    /**
64
-     * Set to receive output headers in all output functions.
65
-     *
66
-     * @param bool true to include all response headers with output, false otherwise
67
-     */
68
-    public function includeResponseHeaders($value)
69
-    {
70
-        curl_setopt($this->ch, CURLOPT_HEADER, $value);
71
-    }
72
-
73
-    /**
74
-     * Set proxy to use for each curl request.
75
-     *
76
-     * @param string proxy
77
-     */
78
-    public function setProxy($proxy)
79
-    {
80
-        curl_setopt($this->ch, CURLOPT_PROXY, $proxy);
81
-    }
82
-
83
-    /**
84
-     * Send post data to target URL
85
-     * return data returned from url or false if error occured.
86
-     *
87
-     * @param string url
88
-     * @param mixed post data (assoc array ie. $foo['post_var_name'] = $value or as string like var=val1&var2=val2)
89
-     * @param string ip address to bind (default null)
90
-     * @param int timeout in sec for complete curl operation (default 10)
91
-     *
92
-     * @return string data
93
-     */
94
-    public function sendPostData($url, $postdata, $ip = null, $timeout = 10)
95
-    {
96
-        //set various curl options first
97
-        // set url to post to
98
-        curl_setopt($this->ch, CURLOPT_URL, $url);
99
-        // return into a variable rather than displaying it
100
-        curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
101
-
102
-        //bind to specific ip address if it is sent trough arguments
103
-        if ($ip) {
104
-            if ($this->debug) {
105
-                echo "Binding to ip $ip\n";
106
-            }
107
-            curl_setopt($this->ch, CURLOPT_INTERFACE, $ip);
108
-        }
109
-
110
-        //set curl function timeout to $timeout
111
-        curl_setopt($this->ch, CURLOPT_TIMEOUT, $timeout);
112
-
113
-        //set method to post
114
-        curl_setopt($this->ch, CURLOPT_POST, true);
115
-        // set post string
116
-        curl_setopt($this->ch, CURLOPT_POSTFIELDS, $postdata);
117
-
118
-        //and finally send curl request
119
-        $result = curl_exec_redir($this->ch);
120
-        if (curl_errno($this->ch)) {
121
-            if ($this->debug) {
122
-                echo "Error Occured in Curl\n";
123
-                echo 'Error number: '.curl_errno($this->ch)."\n";
124
-                echo 'Error message: '.curl_error($this->ch)."\n";
125
-            }
126
-
127
-            return false;
128
-        } else {
129
-            return $result;
130
-        }
131
-    }
132
-
133
-    /**
134
-     * fetch data from target URL
135
-     * return data returned from url or false if error occured.
136
-     *
137
-     * @param string url
138
-     * @param string ip address to bind (default null)
139
-     * @param int timeout in sec for complete curl operation (default 5)
140
-     *
141
-     * @return string data
142
-     */
143
-    public function fetchUrl($url, $ip = null, $timeout = 5)
144
-    {
145
-        // set url to post to
146
-        curl_setopt($this->ch, CURLOPT_URL, $url);
147
-
148
-        //set method to get
149
-        curl_setopt($this->ch, CURLOPT_HTTPGET, true);
150
-        // return into a variable rather than displaying it
151
-        curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
152
-
153
-        //bind to specific ip address if it is sent trough arguments
154
-        if ($ip) {
155
-            if ($this->debug) {
156
-                echo "Binding to ip $ip\n";
157
-            }
158
-
159
-            curl_setopt($this->ch, CURLOPT_INTERFACE, $ip);
160
-        }
161
-
162
-        //set curl function timeout to $timeout
163
-        curl_setopt($this->ch, CURLOPT_TIMEOUT, $timeout);
164
-
165
-        //and finally send curl request
166
-        $result = curl_exec_redir($this->ch);
167
-        if (curl_errno($this->ch)) {
168
-            if ($this->debug) {
169
-                echo "Error Occured in Curl\n";
170
-                echo 'Error number: '.curl_errno($this->ch)."\n";
171
-                echo 'Error message: '.curl_error($this->ch)."\n";
172
-            }
173
-
174
-            return false;
175
-        } else {
176
-            return $result;
177
-        }
178
-    }
179
-
180
-    /**
181
-     * Fetch data from target URL
182
-     * and store it directly to file.
183
-     *
184
-     * @param string url
185
-     * @param resource value stream resource(ie. fopen)
186
-     * @param string ip address to bind (default null)
187
-     * @param int timeout in sec for complete curl operation (default 5)
188
-     *
189
-     * @return bool true on success false othervise
190
-     */
191
-    public function fetchIntoFile($url, $fp, $ip = null, $timeout = 5)
192
-    {
193
-        // set url to post to
194
-        curl_setopt($this->ch, CURLOPT_URL, $url);
195
-        //set method to get
196
-        curl_setopt($this->ch, CURLOPT_HTTPGET, true);
197
-        // store data into file rather than displaying it
198
-        curl_setopt($this->ch, CURLOPT_FILE, $fp);
199
-
200
-        //bind to specific ip address if it is sent trough arguments
201
-        if ($ip) {
202
-            if ($this->debug) {
203
-                echo "Binding to ip $ip\n";
204
-            }
205
-            curl_setopt($this->ch, CURLOPT_INTERFACE, $ip);
206
-        }
207
-
208
-        //set curl function timeout to $timeout
209
-        curl_setopt($this->ch, CURLOPT_TIMEOUT, $timeout);
210
-
211
-        //and finally send curl request
212
-        $result = curl_exec_redir($this->ch);
213
-        if (curl_errno($this->ch)) {
214
-            if ($this->debug) {
215
-                echo "Error Occured in Curl\n";
216
-                echo 'Error number: '.curl_errno($this->ch)."\n";
217
-                echo 'Error message: '.curl_error($this->ch)."\n";
218
-            }
219
-
220
-            return false;
221
-        } else {
222
-            return true;
223
-        }
224
-    }
225
-
226
-    /**
227
-     * Send multipart post data to the target URL
228
-     * return data returned from url or false if error occured
229
-     * (contribution by vule nikolic, [email protected]).
230
-     *
231
-     * @param string url
232
-     * @param array assoc post data array ie. $foo['post_var_name'] = $value
233
-     * @param array assoc                     $file_field_array,    contains file_field name = value - path pairs
234
-     * @param string ip address to bind (default null)
235
-     * @param int timeout in sec for complete curl operation (default 30 sec)
236
-     *
237
-     * @return string data
238
-     */
239
-    public function sendMultipartPostData($url, $postdata, $file_field_array = [], $ip = null, $timeout = 30)
240
-    {
241
-        //set various curl options first
242
-        // set url to post to
243
-        curl_setopt($this->ch, CURLOPT_URL, $url);
244
-        // return into a variable rather than displaying it
245
-        curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
246
-
247
-        //bind to specific ip address if it is sent trough arguments
248
-        if ($ip) {
249
-            if ($this->debug) {
250
-                echo "Binding to ip $ip\n";
251
-            }
252
-
253
-            curl_setopt($this->ch, CURLOPT_INTERFACE, $ip);
254
-        }
255
-
256
-        //set curl function timeout to $timeout
257
-        curl_setopt($this->ch, CURLOPT_TIMEOUT, $timeout);
258
-        //set method to post
259
-        curl_setopt($this->ch, CURLOPT_POST, true);
260
-        // disable Expect header
261
-        // hack to make it working
262
-        $headers = ['Expect: '];
263
-        curl_setopt($this->ch, CURLOPT_HTTPHEADER, $headers);
264
-        // initialize result post array
265
-        $result_post = [];
266
-        //generate post string
267
-        $post_array = [];
268
-        $post_string_array = [];
269
-
270
-        if (!is_array($postdata)) {
271
-            return false;
272
-        }
273
-
274
-        foreach ($postdata as $key => $value) {
275
-            $post_array[$key] = $value;
276
-            $post_string_array[] = urlencode($key).'='.urlencode($value);
277
-        }
278
-
279
-        $post_string = implode('&', $post_string_array);
280
-        if ($this->debug) {
281
-            echo "Post String: $post_string\n";
282
-        }
283
-
284
-        // set post string
285
-        //curl_setopt($this->ch, CURLOPT_POSTFIELDS, $post_string);
286
-        // set multipart form data - file array field-value pairs
287
-        if (!empty($file_field_array)) {
288
-            foreach ($file_field_array as $var_name => $var_value) {
289
-                if (false !== strpos(PHP_OS, 'WIN')) {
290
-                    $var_value = str_replace('/', '\\', $var_value);
291
-                } // win hack
292
-                $file_field_array[$var_name] = '@'.$var_value;
293
-            }
294
-        }
295
-
296
-        // set post data
297
-        $result_post = array_merge($post_array, $file_field_array);
298
-        curl_setopt($this->ch, CURLOPT_POSTFIELDS, $result_post);
299
-
300
-        //and finally send curl request
301
-        $result = curl_exec_redir($this->ch);
302
-        if (curl_errno($this->ch)) {
303
-            if ($this->debug) {
304
-                echo "Error Occured in Curl\n";
305
-                echo 'Error number: '.curl_errno($this->ch)."\n";
306
-                echo 'Error message: '.curl_error($this->ch)."\n";
307
-            }
308
-
309
-            return false;
310
-        } else {
311
-            return $result;
312
-        }
313
-    }
314
-
315
-    /**
316
-     * Set file location where cookie data will be stored and send on each new request.
317
-     *
318
-     * @param string absolute path to cookie file (must be in writable dir)
319
-     */
320
-    public function storeCookies($cookie_file)
321
-    {
322
-        // use cookies on each request (cookies stored in $cookie_file)
323
-        curl_setopt($this->ch, CURLOPT_COOKIEJAR, $cookie_file);
324
-        curl_setopt($this->ch, CURLOPT_COOKIEFILE, $cookie_file);
325
-    }
326
-
327
-    /**
328
-     * Set custom cookie.
329
-     *
330
-     * @param string cookie
331
-     */
332
-    public function setCookie($cookie)
333
-    {
334
-        curl_setopt($this->ch, CURLOPT_COOKIE, $cookie);
335
-    }
336
-
337
-    /**
338
-     * Get last URL info
339
-     * usefull when original url was redirected to other location.
340
-     *
341
-     * @return string url
342
-     */
343
-    public function getEffectiveUrl()
344
-    {
345
-        return curl_getinfo($this->ch, CURLINFO_EFFECTIVE_URL);
346
-    }
347
-
348
-    /**
349
-     * Get http response code.
350
-     *
351
-     * @return int
352
-     */
353
-    public function getHttpResponseCode()
354
-    {
355
-        return curl_getinfo($this->ch, CURLINFO_HTTP_CODE);
356
-    }
357
-
358
-    /**
359
-     * Return last error message and error number.
360
-     *
361
-     * @return string error msg
362
-     */
363
-    public function getErrorMsg()
364
-    {
365
-        $err = 'Error number: '.curl_errno($this->ch)."\n";
366
-        $err .= 'Error message: '.curl_error($this->ch)."\n";
367
-
368
-        return $err;
369
-    }
370
-
371
-    /**
372
-     * Close curl session and free resource
373
-     * Usually no need to call this function directly
374
-     * in case you do you have to call init() to recreate curl.
375
-     */
376
-    public function close()
377
-    {
378
-        //close curl session and free up resources
379
-        curl_close($this->ch);
380
-    }
7
+	public $ch;
8
+	public $debug = false;
9
+	public $error_msg;
10
+
11
+	public function CurlHttpClient($debug = false)
12
+	{
13
+		$this->debug = $debug;
14
+		$this->init();
15
+	}
16
+
17
+	public function init()
18
+	{
19
+		// initialize curl handle
20
+		$this->ch = curl_init();
21
+		//set various options
22
+		//set error in case http return code bigger than 300
23
+		curl_setopt($this->ch, CURLOPT_FAILONERROR, true);
24
+		// use gzip if possible
25
+		curl_setopt($this->ch, CURLOPT_ENCODING, 'gzip, deflate');
26
+		// do not veryfy ssl
27
+		// this is important for windows
28
+		// as well for being able to access pages with non valid cert
29
+		curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
30
+	}
31
+
32
+	/**
33
+	 * Set username/pass for basic http auth.
34
+	 *
35
+	 * @param string user
36
+	 * @param string pass
37
+	 */
38
+	public function setCredentials($username, $password)
39
+	{
40
+		curl_setopt($this->ch, CURLOPT_USERPWD, "$username:$password");
41
+	}
42
+
43
+	/**
44
+	 * Set referrer.
45
+	 *
46
+	 * @param string referrer url
47
+	 */
48
+	public function setReferrer($referrer_url)
49
+	{
50
+		curl_setopt($this->ch, CURLOPT_REFERER, $referrer_url);
51
+	}
52
+
53
+	/**
54
+	 * Set client's userAgent.
55
+	 *
56
+	 * @param string user agent
57
+	 */
58
+	public function setUserAgent($userAgent)
59
+	{
60
+		curl_setopt($this->ch, CURLOPT_USERAGENT, $userAgent);
61
+	}
62
+
63
+	/**
64
+	 * Set to receive output headers in all output functions.
65
+	 *
66
+	 * @param bool true to include all response headers with output, false otherwise
67
+	 */
68
+	public function includeResponseHeaders($value)
69
+	{
70
+		curl_setopt($this->ch, CURLOPT_HEADER, $value);
71
+	}
72
+
73
+	/**
74
+	 * Set proxy to use for each curl request.
75
+	 *
76
+	 * @param string proxy
77
+	 */
78
+	public function setProxy($proxy)
79
+	{
80
+		curl_setopt($this->ch, CURLOPT_PROXY, $proxy);
81
+	}
82
+
83
+	/**
84
+	 * Send post data to target URL
85
+	 * return data returned from url or false if error occured.
86
+	 *
87
+	 * @param string url
88
+	 * @param mixed post data (assoc array ie. $foo['post_var_name'] = $value or as string like var=val1&var2=val2)
89
+	 * @param string ip address to bind (default null)
90
+	 * @param int timeout in sec for complete curl operation (default 10)
91
+	 *
92
+	 * @return string data
93
+	 */
94
+	public function sendPostData($url, $postdata, $ip = null, $timeout = 10)
95
+	{
96
+		//set various curl options first
97
+		// set url to post to
98
+		curl_setopt($this->ch, CURLOPT_URL, $url);
99
+		// return into a variable rather than displaying it
100
+		curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
101
+
102
+		//bind to specific ip address if it is sent trough arguments
103
+		if ($ip) {
104
+			if ($this->debug) {
105
+				echo "Binding to ip $ip\n";
106
+			}
107
+			curl_setopt($this->ch, CURLOPT_INTERFACE, $ip);
108
+		}
109
+
110
+		//set curl function timeout to $timeout
111
+		curl_setopt($this->ch, CURLOPT_TIMEOUT, $timeout);
112
+
113
+		//set method to post
114
+		curl_setopt($this->ch, CURLOPT_POST, true);
115
+		// set post string
116
+		curl_setopt($this->ch, CURLOPT_POSTFIELDS, $postdata);
117
+
118
+		//and finally send curl request
119
+		$result = curl_exec_redir($this->ch);
120
+		if (curl_errno($this->ch)) {
121
+			if ($this->debug) {
122
+				echo "Error Occured in Curl\n";
123
+				echo 'Error number: '.curl_errno($this->ch)."\n";
124
+				echo 'Error message: '.curl_error($this->ch)."\n";
125
+			}
126
+
127
+			return false;
128
+		} else {
129
+			return $result;
130
+		}
131
+	}
132
+
133
+	/**
134
+	 * fetch data from target URL
135
+	 * return data returned from url or false if error occured.
136
+	 *
137
+	 * @param string url
138
+	 * @param string ip address to bind (default null)
139
+	 * @param int timeout in sec for complete curl operation (default 5)
140
+	 *
141
+	 * @return string data
142
+	 */
143
+	public function fetchUrl($url, $ip = null, $timeout = 5)
144
+	{
145
+		// set url to post to
146
+		curl_setopt($this->ch, CURLOPT_URL, $url);
147
+
148
+		//set method to get
149
+		curl_setopt($this->ch, CURLOPT_HTTPGET, true);
150
+		// return into a variable rather than displaying it
151
+		curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
152
+
153
+		//bind to specific ip address if it is sent trough arguments
154
+		if ($ip) {
155
+			if ($this->debug) {
156
+				echo "Binding to ip $ip\n";
157
+			}
158
+
159
+			curl_setopt($this->ch, CURLOPT_INTERFACE, $ip);
160
+		}
161
+
162
+		//set curl function timeout to $timeout
163
+		curl_setopt($this->ch, CURLOPT_TIMEOUT, $timeout);
164
+
165
+		//and finally send curl request
166
+		$result = curl_exec_redir($this->ch);
167
+		if (curl_errno($this->ch)) {
168
+			if ($this->debug) {
169
+				echo "Error Occured in Curl\n";
170
+				echo 'Error number: '.curl_errno($this->ch)."\n";
171
+				echo 'Error message: '.curl_error($this->ch)."\n";
172
+			}
173
+
174
+			return false;
175
+		} else {
176
+			return $result;
177
+		}
178
+	}
179
+
180
+	/**
181
+	 * Fetch data from target URL
182
+	 * and store it directly to file.
183
+	 *
184
+	 * @param string url
185
+	 * @param resource value stream resource(ie. fopen)
186
+	 * @param string ip address to bind (default null)
187
+	 * @param int timeout in sec for complete curl operation (default 5)
188
+	 *
189
+	 * @return bool true on success false othervise
190
+	 */
191
+	public function fetchIntoFile($url, $fp, $ip = null, $timeout = 5)
192
+	{
193
+		// set url to post to
194
+		curl_setopt($this->ch, CURLOPT_URL, $url);
195
+		//set method to get
196
+		curl_setopt($this->ch, CURLOPT_HTTPGET, true);
197
+		// store data into file rather than displaying it
198
+		curl_setopt($this->ch, CURLOPT_FILE, $fp);
199
+
200
+		//bind to specific ip address if it is sent trough arguments
201
+		if ($ip) {
202
+			if ($this->debug) {
203
+				echo "Binding to ip $ip\n";
204
+			}
205
+			curl_setopt($this->ch, CURLOPT_INTERFACE, $ip);
206
+		}
207
+
208
+		//set curl function timeout to $timeout
209
+		curl_setopt($this->ch, CURLOPT_TIMEOUT, $timeout);
210
+
211
+		//and finally send curl request
212
+		$result = curl_exec_redir($this->ch);
213
+		if (curl_errno($this->ch)) {
214
+			if ($this->debug) {
215
+				echo "Error Occured in Curl\n";
216
+				echo 'Error number: '.curl_errno($this->ch)."\n";
217
+				echo 'Error message: '.curl_error($this->ch)."\n";
218
+			}
219
+
220
+			return false;
221
+		} else {
222
+			return true;
223
+		}
224
+	}
225
+
226
+	/**
227
+	 * Send multipart post data to the target URL
228
+	 * return data returned from url or false if error occured
229
+	 * (contribution by vule nikolic, [email protected]).
230
+	 *
231
+	 * @param string url
232
+	 * @param array assoc post data array ie. $foo['post_var_name'] = $value
233
+	 * @param array assoc                     $file_field_array,    contains file_field name = value - path pairs
234
+	 * @param string ip address to bind (default null)
235
+	 * @param int timeout in sec for complete curl operation (default 30 sec)
236
+	 *
237
+	 * @return string data
238
+	 */
239
+	public function sendMultipartPostData($url, $postdata, $file_field_array = [], $ip = null, $timeout = 30)
240
+	{
241
+		//set various curl options first
242
+		// set url to post to
243
+		curl_setopt($this->ch, CURLOPT_URL, $url);
244
+		// return into a variable rather than displaying it
245
+		curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
246
+
247
+		//bind to specific ip address if it is sent trough arguments
248
+		if ($ip) {
249
+			if ($this->debug) {
250
+				echo "Binding to ip $ip\n";
251
+			}
252
+
253
+			curl_setopt($this->ch, CURLOPT_INTERFACE, $ip);
254
+		}
255
+
256
+		//set curl function timeout to $timeout
257
+		curl_setopt($this->ch, CURLOPT_TIMEOUT, $timeout);
258
+		//set method to post
259
+		curl_setopt($this->ch, CURLOPT_POST, true);
260
+		// disable Expect header
261
+		// hack to make it working
262
+		$headers = ['Expect: '];
263
+		curl_setopt($this->ch, CURLOPT_HTTPHEADER, $headers);
264
+		// initialize result post array
265
+		$result_post = [];
266
+		//generate post string
267
+		$post_array = [];
268
+		$post_string_array = [];
269
+
270
+		if (!is_array($postdata)) {
271
+			return false;
272
+		}
273
+
274
+		foreach ($postdata as $key => $value) {
275
+			$post_array[$key] = $value;
276
+			$post_string_array[] = urlencode($key).'='.urlencode($value);
277
+		}
278
+
279
+		$post_string = implode('&', $post_string_array);
280
+		if ($this->debug) {
281
+			echo "Post String: $post_string\n";
282
+		}
283
+
284
+		// set post string
285
+		//curl_setopt($this->ch, CURLOPT_POSTFIELDS, $post_string);
286
+		// set multipart form data - file array field-value pairs
287
+		if (!empty($file_field_array)) {
288
+			foreach ($file_field_array as $var_name => $var_value) {
289
+				if (false !== strpos(PHP_OS, 'WIN')) {
290
+					$var_value = str_replace('/', '\\', $var_value);
291
+				} // win hack
292
+				$file_field_array[$var_name] = '@'.$var_value;
293
+			}
294
+		}
295
+
296
+		// set post data
297
+		$result_post = array_merge($post_array, $file_field_array);
298
+		curl_setopt($this->ch, CURLOPT_POSTFIELDS, $result_post);
299
+
300
+		//and finally send curl request
301
+		$result = curl_exec_redir($this->ch);
302
+		if (curl_errno($this->ch)) {
303
+			if ($this->debug) {
304
+				echo "Error Occured in Curl\n";
305
+				echo 'Error number: '.curl_errno($this->ch)."\n";
306
+				echo 'Error message: '.curl_error($this->ch)."\n";
307
+			}
308
+
309
+			return false;
310
+		} else {
311
+			return $result;
312
+		}
313
+	}
314
+
315
+	/**
316
+	 * Set file location where cookie data will be stored and send on each new request.
317
+	 *
318
+	 * @param string absolute path to cookie file (must be in writable dir)
319
+	 */
320
+	public function storeCookies($cookie_file)
321
+	{
322
+		// use cookies on each request (cookies stored in $cookie_file)
323
+		curl_setopt($this->ch, CURLOPT_COOKIEJAR, $cookie_file);
324
+		curl_setopt($this->ch, CURLOPT_COOKIEFILE, $cookie_file);
325
+	}
326
+
327
+	/**
328
+	 * Set custom cookie.
329
+	 *
330
+	 * @param string cookie
331
+	 */
332
+	public function setCookie($cookie)
333
+	{
334
+		curl_setopt($this->ch, CURLOPT_COOKIE, $cookie);
335
+	}
336
+
337
+	/**
338
+	 * Get last URL info
339
+	 * usefull when original url was redirected to other location.
340
+	 *
341
+	 * @return string url
342
+	 */
343
+	public function getEffectiveUrl()
344
+	{
345
+		return curl_getinfo($this->ch, CURLINFO_EFFECTIVE_URL);
346
+	}
347
+
348
+	/**
349
+	 * Get http response code.
350
+	 *
351
+	 * @return int
352
+	 */
353
+	public function getHttpResponseCode()
354
+	{
355
+		return curl_getinfo($this->ch, CURLINFO_HTTP_CODE);
356
+	}
357
+
358
+	/**
359
+	 * Return last error message and error number.
360
+	 *
361
+	 * @return string error msg
362
+	 */
363
+	public function getErrorMsg()
364
+	{
365
+		$err = 'Error number: '.curl_errno($this->ch)."\n";
366
+		$err .= 'Error message: '.curl_error($this->ch)."\n";
367
+
368
+		return $err;
369
+	}
370
+
371
+	/**
372
+	 * Close curl session and free resource
373
+	 * Usually no need to call this function directly
374
+	 * in case you do you have to call init() to recreate curl.
375
+	 */
376
+	public function close()
377
+	{
378
+		//close curl session and free up resources
379
+		curl_close($this->ch);
380
+	}
381 381
 }
382 382
 
383 383
 /**
@@ -386,63 +386,63 @@  discard block
 block discarded – undo
386 386
  */
387 387
 function curlExecRedir($ch)
388 388
 {
389
-    static $curl_loops = 0;
390
-    static $curl_max_loops = 20;
389
+	static $curl_loops = 0;
390
+	static $curl_max_loops = 20;
391 391
 
392
-    if ($curl_loops++ >= $curl_max_loops) {
393
-        $curl_loops = 0;
392
+	if ($curl_loops++ >= $curl_max_loops) {
393
+		$curl_loops = 0;
394 394
 
395
-        return false;
396
-    }
395
+		return false;
396
+	}
397 397
 
398
-    curl_setopt($ch, CURLOPT_HTTPHEADER, ['Expect:']);
399
-    curl_setopt($ch, CURLOPT_HEADER, true);
400
-    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
401
-    curl_setopt($ch, CURLOPT_VERBOSE, false);
402
-    $data = curl_exec($ch);
403
-    $data = str_replace("\r", "\n", str_replace("\r\n", "\n", $data));
404
-    list($header, $data) = explode("\n\n", $data, 2);
405
-    $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
398
+	curl_setopt($ch, CURLOPT_HTTPHEADER, ['Expect:']);
399
+	curl_setopt($ch, CURLOPT_HEADER, true);
400
+	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
401
+	curl_setopt($ch, CURLOPT_VERBOSE, false);
402
+	$data = curl_exec($ch);
403
+	$data = str_replace("\r", "\n", str_replace("\r\n", "\n", $data));
404
+	list($header, $data) = explode("\n\n", $data, 2);
405
+	$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
406 406
 
407
-    //echo "*** Got HTTP code: $http_code ***\n";
408
-    //echo "**  Got headers: \n$header\n\n";
407
+	//echo "*** Got HTTP code: $http_code ***\n";
408
+	//echo "**  Got headers: \n$header\n\n";
409 409
 
410
-    if (301 == $http_code || 302 == $http_code) {
411
-        // If we're redirected, we should revert to GET
412
-        curl_setopt($ch, CURLOPT_HTTPGET, true);
410
+	if (301 == $http_code || 302 == $http_code) {
411
+		// If we're redirected, we should revert to GET
412
+		curl_setopt($ch, CURLOPT_HTTPGET, true);
413 413
 
414
-        $matches = [];
415
-        preg_match('/Location:\s*(.*?)(\n|$)/i', $header, $matches);
416
-        $url = @parse_url(trim($matches[1]));
414
+		$matches = [];
415
+		preg_match('/Location:\s*(.*?)(\n|$)/i', $header, $matches);
416
+		$url = @parse_url(trim($matches[1]));
417 417
 
418
-        if (!$url) {
419
-            //couldn't process the url to redirect to
420
-            $curl_loops = 0;
418
+		if (!$url) {
419
+			//couldn't process the url to redirect to
420
+			$curl_loops = 0;
421 421
 
422
-            return $data;
423
-        }
422
+			return $data;
423
+		}
424 424
 
425
-        $last_url = parse_url(curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));
426
-        if (empty($url['scheme'])) {
427
-            $url['scheme'] = $last_url['scheme'];
428
-        }
425
+		$last_url = parse_url(curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));
426
+		if (empty($url['scheme'])) {
427
+			$url['scheme'] = $last_url['scheme'];
428
+		}
429 429
 
430
-        if (empty($url['host'])) {
431
-            $url['host'] = $last_url['host'];
432
-        }
430
+		if (empty($url['host'])) {
431
+			$url['host'] = $last_url['host'];
432
+		}
433 433
 
434
-        if (empty($url['path'])) {
435
-            $url['path'] = $last_url['path'];
436
-        }
434
+		if (empty($url['path'])) {
435
+			$url['path'] = $last_url['path'];
436
+		}
437 437
 
438
-        $new_url = $url['scheme'].'://'.$url['host'].$url['path'].(!empty($url['query']) ? '?'.$url['query'] : '');
439
-        //echo "Being redirected to $new_url\n";
440
-        curl_setopt($ch, CURLOPT_URL, $new_url);
438
+		$new_url = $url['scheme'].'://'.$url['host'].$url['path'].(!empty($url['query']) ? '?'.$url['query'] : '');
439
+		//echo "Being redirected to $new_url\n";
440
+		curl_setopt($ch, CURLOPT_URL, $new_url);
441 441
 
442
-        return curl_exec_redir($ch);
443
-    } else {
444
-        $curl_loops = 0;
442
+		return curl_exec_redir($ch);
443
+	} else {
444
+		$curl_loops = 0;
445 445
 
446
-        return $data;
447
-    }
446
+		return $data;
447
+	}
448 448
 }
Please login to merge, or discard this patch.
src/Route4Me/Members/MemberAuthenticationResponse.php 1 patch
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -10,194 +10,194 @@
 block discarded – undo
10 10
  */
11 11
 class MemberAuthenticationResponse extends \Route4Me\Common
12 12
 {
13
-    /** @var boolean $status
14
-     * True, if authentication process was finished successfuly.
15
-     */
16
-    public $status;
17
-
18
-    /** @var string $geocoding_service
19
-     * Geocoding service
20
-     */
21
-    public $geocoding_service;
22
-
23
-    /** @var int $session_id
24
-     * Session ID
25
-     */
26
-    public $session_id;
27
-
28
-    /** @var string $session_guid
29
-     * Session guid
30
-     */
31
-    public $session_guid;
32
-
33
-    /** @var int $member_id
34
-     * Member ID
35
-     */
36
-    public $member_id;
37
-
38
-    /** @var string $api_key
39
-     * API key of an user
40
-     */
41
-    public $api_key;
42
-
43
-    /** @var int $tracking_ttl
44
-     * Tracking TTL
45
-     */
46
-    public $tracking_ttl;
47
-
48
-    /** @var string $update_channel_name
49
-     * Update channel name
50
-     */
51
-    public $update_channel_name;
52
-
53
-    /** @var string $geofence_polygon_shape
54
-     * Geofence polygon shape. ENUM('circle', 'poly', 'rect').
55
-     */
56
-    public $geofence_polygon_shape ;
57
-
58
-    /** @var int $geofence_polygon_size
59
-     * Geofence polygon size
60
-     */
61
-    public $geofence_polygon_size;
62
-
63
-    /** @var int $geofence_time_onsite_trigger_secs
64
-     * Geofence time onsite trigger in seconds.
65
-     */
66
-    public $geofence_time_onsite_trigger_secs;
67
-
68
-    /** @var int $geofence_minimum_trigger_speed
69
-     * Geofence minimum trigger speed.
70
-     */
71
-    public $geofence_minimum_trigger_speed;
72
-
73
-    /** @var boolean $is_subscription_past_due
74
-     * If true, subscription is past due.
75
-     */
76
-    public $is_subscription_past_due;
77
-
78
-    /** @var string $visited_departed_enabled
79
-     * if true, triggering of the visited and departed activities is enabled.
80
-     */
81
-    public $visited_departed_enabled;
82
-
83
-    /** @var string $long_press_enabled
84
-     * if true, long press is enabled.
85
-     */
86
-    public $long_press_enabled;
87
-
88
-    /** @var string $account_type_id
89
-     * The account type ID
90
-     */
91
-    public $account_type_id;
92
-
93
-    /** @var string $account_type_alias
94
-     * Account type alias.
95
-     */
96
-    public $account_type_alias;
97
-
98
-    /** @var string $member_type
99
-     * A type of the member.
100
-     * Available values:
101
-     * 'PRIMARY_ACCOUNT',
102
-     * 'SUB_ACCOUNT_ADMIN',
103
-     * 'SUB_ACCOUNT_REGIONAL_MANAGER',
104
-     * 'SUB_ACCOUNT_DISPATCHER',
105
-     * 'SUB_ACCOUNT_PLANNER',
106
-     * 'SUB_ACCOUNT_DRIVER',
107
-     * 'SUB_ACCOUNT_ANALYST',
108
-     * 'SUB_ACCOUNT_VENDOR',
109
-     * 'SUB_ACCOUNT_CUSTOMER_SERVICE'
110
-     */
111
-    public $member_type;
112
-
113
-    /** @var string $max_stops_per_route
114
-     * Maximum stops per route.
115
-     */
116
-    public $max_stops_per_route;
117
-
118
-    /** @var string $max_routes
119
-     * Maximum number of the routes.
120
-     */
121
-    public $max_routes;
122
-
123
-    /** @var int $routes_planned
124
-     * Number of the planned routes by an user.
125
-     */
126
-    public $routes_planned;
127
-
128
-    /** @var string $preferred_units
129
-     * Preferred units. Enum('km', 'mi').
130
-     */
131
-    public $preferred_units;
132
-
133
-    /** @var string $preferred_language
134
-     * Preferred language. Enum('en', 'fr').
135
-     */
136
-    public $preferred_language;
137
-
138
-    /** @var string $HIDE_ROUTED_ADDRESSES
139
-     * If true, routed addresses will be hidden.
140
-     */
141
-    public $HIDE_ROUTED_ADDRESSES;
142
-
143
-    /** @var string $HIDE_VISITED_ADDRESSES
144
-     * If true, visited addresses will be hidden.
145
-     */
146
-    public $HIDE_VISITED_ADDRESSES;
147
-
148
-    /** @var string $HIDE_NONFUTURE_ROUTES
149
-     * If equal to true, nonfuture addresses will be hidden.
150
-     */
151
-    public $HIDE_NONFUTURE_ROUTES;
152
-
153
-    /** @var string $READONLY_USER
154
-     * If equal to true, user can only read data.
155
-     */
156
-    public $READONLY_USER;
157
-
158
-    /** @var int $auto_logout_ts
159
-     * Time in seconds. If a user is inactive during this period, he will be logout.
160
-     */
161
-    public $auto_logout_ts;
162
-
163
-    /** @var string $last_known_member_payment_device
164
-     * Last known member payment device (e.g. 'web')
165
-     */
166
-    public $last_known_member_payment_device;
167
-
168
-    /** @var int $account_expires_timestamp
169
-     * Account expire date
170
-     */
171
-    public $account_expires_timestamp;
172
-
173
-    /** @var boolean $account_past_due
174
-     * Account past due
175
-     */
176
-    public $account_past_due;
177
-
178
-    /** @var array  $licensed_modules
179
-     * Licensed module. e.g.:
180
-     * 'MODULE__ROUTE_EDITOR_CUSTOM_DATA_EDITING',
181
-     * 'MODULE__VOICE_NAVIGATION:TRUE',
182
-     * 'MODULE__VOICE_NAVIGATION'
183
-     */
184
-    public $licensed_modules;
185
-
186
-    /** @var int $last_active_timestamp
187
-     * Last active timestamp
188
-     */
189
-    public $last_active_timestamp;
190
-
191
-    public static function fromArray(array $params)
192
-    {
193
-        $memberAurhenticateResponse = new self();
194
-
195
-        foreach ($params as $key => $value) {
196
-            if (property_exists($memberAurhenticateResponse, $key)) {
197
-                $memberAurhenticateResponse->{$key} = $value;
198
-            }
199
-        }
200
-
201
-        return $memberAurhenticateResponse;
202
-    }
13
+	/** @var boolean $status
14
+	 * True, if authentication process was finished successfuly.
15
+	 */
16
+	public $status;
17
+
18
+	/** @var string $geocoding_service
19
+	 * Geocoding service
20
+	 */
21
+	public $geocoding_service;
22
+
23
+	/** @var int $session_id
24
+	 * Session ID
25
+	 */
26
+	public $session_id;
27
+
28
+	/** @var string $session_guid
29
+	 * Session guid
30
+	 */
31
+	public $session_guid;
32
+
33
+	/** @var int $member_id
34
+	 * Member ID
35
+	 */
36
+	public $member_id;
37
+
38
+	/** @var string $api_key
39
+	 * API key of an user
40
+	 */
41
+	public $api_key;
42
+
43
+	/** @var int $tracking_ttl
44
+	 * Tracking TTL
45
+	 */
46
+	public $tracking_ttl;
47
+
48
+	/** @var string $update_channel_name
49
+	 * Update channel name
50
+	 */
51
+	public $update_channel_name;
52
+
53
+	/** @var string $geofence_polygon_shape
54
+	 * Geofence polygon shape. ENUM('circle', 'poly', 'rect').
55
+	 */
56
+	public $geofence_polygon_shape ;
57
+
58
+	/** @var int $geofence_polygon_size
59
+	 * Geofence polygon size
60
+	 */
61
+	public $geofence_polygon_size;
62
+
63
+	/** @var int $geofence_time_onsite_trigger_secs
64
+	 * Geofence time onsite trigger in seconds.
65
+	 */
66
+	public $geofence_time_onsite_trigger_secs;
67
+
68
+	/** @var int $geofence_minimum_trigger_speed
69
+	 * Geofence minimum trigger speed.
70
+	 */
71
+	public $geofence_minimum_trigger_speed;
72
+
73
+	/** @var boolean $is_subscription_past_due
74
+	 * If true, subscription is past due.
75
+	 */
76
+	public $is_subscription_past_due;
77
+
78
+	/** @var string $visited_departed_enabled
79
+	 * if true, triggering of the visited and departed activities is enabled.
80
+	 */
81
+	public $visited_departed_enabled;
82
+
83
+	/** @var string $long_press_enabled
84
+	 * if true, long press is enabled.
85
+	 */
86
+	public $long_press_enabled;
87
+
88
+	/** @var string $account_type_id
89
+	 * The account type ID
90
+	 */
91
+	public $account_type_id;
92
+
93
+	/** @var string $account_type_alias
94
+	 * Account type alias.
95
+	 */
96
+	public $account_type_alias;
97
+
98
+	/** @var string $member_type
99
+	 * A type of the member.
100
+	 * Available values:
101
+	 * 'PRIMARY_ACCOUNT',
102
+	 * 'SUB_ACCOUNT_ADMIN',
103
+	 * 'SUB_ACCOUNT_REGIONAL_MANAGER',
104
+	 * 'SUB_ACCOUNT_DISPATCHER',
105
+	 * 'SUB_ACCOUNT_PLANNER',
106
+	 * 'SUB_ACCOUNT_DRIVER',
107
+	 * 'SUB_ACCOUNT_ANALYST',
108
+	 * 'SUB_ACCOUNT_VENDOR',
109
+	 * 'SUB_ACCOUNT_CUSTOMER_SERVICE'
110
+	 */
111
+	public $member_type;
112
+
113
+	/** @var string $max_stops_per_route
114
+	 * Maximum stops per route.
115
+	 */
116
+	public $max_stops_per_route;
117
+
118
+	/** @var string $max_routes
119
+	 * Maximum number of the routes.
120
+	 */
121
+	public $max_routes;
122
+
123
+	/** @var int $routes_planned
124
+	 * Number of the planned routes by an user.
125
+	 */
126
+	public $routes_planned;
127
+
128
+	/** @var string $preferred_units
129
+	 * Preferred units. Enum('km', 'mi').
130
+	 */
131
+	public $preferred_units;
132
+
133
+	/** @var string $preferred_language
134
+	 * Preferred language. Enum('en', 'fr').
135
+	 */
136
+	public $preferred_language;
137
+
138
+	/** @var string $HIDE_ROUTED_ADDRESSES
139
+	 * If true, routed addresses will be hidden.
140
+	 */
141
+	public $HIDE_ROUTED_ADDRESSES;
142
+
143
+	/** @var string $HIDE_VISITED_ADDRESSES
144
+	 * If true, visited addresses will be hidden.
145
+	 */
146
+	public $HIDE_VISITED_ADDRESSES;
147
+
148
+	/** @var string $HIDE_NONFUTURE_ROUTES
149
+	 * If equal to true, nonfuture addresses will be hidden.
150
+	 */
151
+	public $HIDE_NONFUTURE_ROUTES;
152
+
153
+	/** @var string $READONLY_USER
154
+	 * If equal to true, user can only read data.
155
+	 */
156
+	public $READONLY_USER;
157
+
158
+	/** @var int $auto_logout_ts
159
+	 * Time in seconds. If a user is inactive during this period, he will be logout.
160
+	 */
161
+	public $auto_logout_ts;
162
+
163
+	/** @var string $last_known_member_payment_device
164
+	 * Last known member payment device (e.g. 'web')
165
+	 */
166
+	public $last_known_member_payment_device;
167
+
168
+	/** @var int $account_expires_timestamp
169
+	 * Account expire date
170
+	 */
171
+	public $account_expires_timestamp;
172
+
173
+	/** @var boolean $account_past_due
174
+	 * Account past due
175
+	 */
176
+	public $account_past_due;
177
+
178
+	/** @var array  $licensed_modules
179
+	 * Licensed module. e.g.:
180
+	 * 'MODULE__ROUTE_EDITOR_CUSTOM_DATA_EDITING',
181
+	 * 'MODULE__VOICE_NAVIGATION:TRUE',
182
+	 * 'MODULE__VOICE_NAVIGATION'
183
+	 */
184
+	public $licensed_modules;
185
+
186
+	/** @var int $last_active_timestamp
187
+	 * Last active timestamp
188
+	 */
189
+	public $last_active_timestamp;
190
+
191
+	public static function fromArray(array $params)
192
+	{
193
+		$memberAurhenticateResponse = new self();
194
+
195
+		foreach ($params as $key => $value) {
196
+			if (property_exists($memberAurhenticateResponse, $key)) {
197
+				$memberAurhenticateResponse->{$key} = $value;
198
+			}
199
+		}
200
+
201
+		return $memberAurhenticateResponse;
202
+	}
203 203
 }
204 204
\ No newline at end of file
Please login to merge, or discard this patch.
src/Route4Me/Members/MemberCapabilities.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,51 +7,51 @@
 block discarded – undo
7 7
  */
8 8
 class MemberCapabilities extends \Route4Me\Common
9 9
 {
10
-    /*
10
+	/*
11 11
      * Array of the avoidance zone IDs.
12 12
      */
13
-    public $avoid = [];
13
+	public $avoid = [];
14 14
 
15
-    /*
15
+	/*
16 16
      * Road avoid options: "Highways", "Tolls", "highways,tolls".
17 17
      */
18
-    public $avoid_roads = [];
18
+	public $avoid_roads = [];
19 19
 
20
-    /*
20
+	/*
21 21
      * Restriction options.
22 22
      */
23
-    public $features = [];
23
+	public $features = [];
24 24
 
25
-    /*
25
+	/*
26 26
      * Travel modes: "Highways", "Tolls", "highways,tolls".
27 27
      */
28
-    public $travelModes = [];
28
+	public $travelModes = [];
29 29
 
30
-    /*
30
+	/*
31 31
      * Navigate options
32 32
      */
33
-    public $navigateBy = [];
33
+	public $navigateBy = [];
34 34
 
35
-    /*
35
+	/*
36 36
      * Array of the license modules
37 37
      */
38
-    public $LicensedModules = [];
38
+	public $LicensedModules = [];
39 39
 
40
-    /*
40
+	/*
41 41
      * If true, the member subscription is commercial.
42 42
      */
43
-    public $commercial;
43
+	public $commercial;
44 44
 
45
-    public static function fromArray(array $params)
46
-    {
47
-        $memberCapabilities = new self();
45
+	public static function fromArray(array $params)
46
+	{
47
+		$memberCapabilities = new self();
48 48
 
49
-        foreach ($params as $key => $value) {
50
-            if (property_exists($memberCapabilities, $key)) {
51
-                $memberCapabilities->{$key} = $value;
52
-            }
53
-        }
49
+		foreach ($params as $key => $value) {
50
+			if (property_exists($memberCapabilities, $key)) {
51
+				$memberCapabilities->{$key} = $value;
52
+			}
53
+		}
54 54
 
55
-        return $memberCapabilities;
56
-    }
55
+		return $memberCapabilities;
56
+	}
57 57
 }
Please login to merge, or discard this patch.
src/Route4Me/Members/MemberResponse.php 1 patch
Indentation   +406 added lines, -406 removed lines patch added patch discarded remove patch
@@ -9,411 +9,411 @@
 block discarded – undo
9 9
  */
10 10
 class MemberResponse extends \Route4Me\Common
11 11
 {
12
-    /** @var boolean $authenticated
13
-     * A boolean flag indicating if the session is valid.
14
-     */
15
-    public $authenticated;
16
-
17
-    /** @var boolean $status
18
-     * Process status
19
-     */
20
-    public $status;
21
-
22
-    /** @var string $geocoding_service
23
-     * Geocoding service
24
-     */
25
-    public $geocoding_service;
26
-
27
-    /** @var string $session_id
28
-     * The integer session id of the current session.
29
-     */
30
-    public $session_id;
31
-
32
-    /** @var string $session_guid
33
-     * An MD5 hash string of the currently authenticated sesssion,
34
-     * important to use this with future requests.
35
-     */
36
-    public $session_guid;
37
-
38
-    /** @var string $member_first_name
39
-     * The first name of the user.
40
-     */
41
-    public $member_first_name;
42
-
43
-    /** @var string $member_last_name
44
-     * The last name of the user.
45
-     */
46
-    public $member_last_name;
47
-
48
-    /** @var int $member_timestamp_added
49
-     * The unix timestamp when the user joined the service.
50
-     */
51
-    public $member_timestamp_added;
52
-
53
-    /** @var string $industry
54
-     * The industry the authenticated user specified.
55
-     */
56
-    public $industry;
57
-
58
-    /** @var int $member_id
59
-     * Member ID
60
-     */
61
-    public $member_id;
62
-
63
-    /** @var string $member_email
64
-     * Member email
65
-     */
66
-    public $member_email;
67
-
68
-    /** @var boolean $is_trial
69
-     * If the user is currently a trial customer.
70
-     */
71
-    public $is_trial;
72
-
73
-    /** @var boolean $is_active
74
-     * If the user is currently an active customer.
75
-     */
76
-    public $is_active;
77
-
78
-    /** @var string $api_key
79
-     * User's API key
80
-     */
81
-    public $api_key;
82
-
83
-    /** @var int $tracking_ttl
84
-     * Tracking TTL
85
-     */
86
-    public $tracking_ttl;
87
-
88
-    /** @var boolean $hide_billing_section
89
-     * Hide billing section.
90
-     */
91
-    public $hide_billing_section;
92
-
93
-    /** @var string $last_known_member_payment_device
94
-     * Last known member payment device (e.g. 'web').
95
-     */
96
-    public $last_known_member_payment_device;
97
-
98
-    /** @var array $licensed_modules
99
-     * Licensed module. e.g.:
100
-     * 'MODULE__ROUTE_EDITOR_CUSTOM_DATA_EDITING',
101
-     * 'MODULE__VOICE_NAVIGATION:TRUE',
102
-     * 'MODULE__VOICE_NAVIGATION'
103
-     */
104
-    public $licensed_modules;
105
-
106
-    /** @var boolean $member_business_type
107
-     * Member business type (e.g. 'BUSINESS_EMPLOYEE').
108
-     */
109
-    public $member_business_type;
110
-
111
-    /** @var string $geofence_polygon_shape
112
-     * Geofence polygon shape. Available values:
113
-     * 'circle', 'poly', 'rect'.
114
-     */
115
-    public $geofence_polygon_shape;
116
-
117
-    /** @var int $geofence_polygon_size
118
-     * Geofence polygon size
119
-     */
120
-    public $geofence_polygon_size;
121
-
122
-    /** @var int $geofence_time_onsite_trigger_secs
123
-     * Geofence onsite trigger time (seconds).
124
-     */
125
-    public $geofence_time_onsite_trigger_secs;
126
-
127
-    /** @var int $geofence_minimum_trigger_speed
128
-     * Geofence's minimum trigger speed.
129
-     */
130
-    public $geofence_minimum_trigger_speed;
131
-
132
-    /** @var bool $is_subscription_past_due
133
-     * True if the subscription is past due.
134
-     */
135
-    public $is_subscription_past_due;
136
-
137
-    /** @var string $visited_departed_enabled
138
-     * If true, triggering of the visited and departed activities is enabled.
139
-     */
140
-    public $visited_departed_enabled;
141
-
142
-    /** @var string $long_press_enabled
143
-     * If true, long press is enabled.
144
-     */
145
-    public $long_press_enabled;
146
-
147
-    /** @var int $account_type_id
148
-     * The account type ID.
149
-     */
150
-    public $account_type_id;
151
-
152
-    /** @var string $current_price
153
-     * Current price (e.g. '0.000').
154
-     */
155
-    public $current_price;
156
-
157
-    /** @var int $initially_requested_account_type_id
158
-     * Initially Requested account type ID.
159
-     */
160
-    public $initially_requested_account_type_id;
161
-
162
-    /** @var string $account_type_alias
163
-     * Account type alias
164
-     */
165
-    public $account_type_alias;
166
-
167
-    /** @var string $member_type
168
-     * Member type. Available values:
169
-     * PRIMARY_ACCOUNT, SUB_ACCOUNT_ADMIN, SUB_ACCOUNT_REGIONAL_MANAGER,
170
-     * SUB_ACCOUNT_DISPATCHER, SUB_ACCOUNT_PLANNER, SUB_ACCOUNT_DRIVER,
171
-     * SUB_ACCOUNT_ANALYSTSUB_ACCOUNT_VENDORSUB_ACCOUNT_CUSTOMER_SERVICE
172
-     */
173
-    public $member_type;
174
-
175
-    /** @var string $OWNER_MEMBER_ID
176
-     * Parent user ID.
177
-     */
178
-    public $OWNER_MEMBER_ID;
179
-
180
-    /** @var string $ROOT_OWNER_MEMBER_ID
181
-     * Root owner member ID (e.g. '402088').
182
-     */
183
-    public $ROOT_OWNER_MEMBER_ID;
184
-
185
-    /** @var string $ROOT_OWNER_MEMBER_EMAIL
186
-     * Root owner member email.
187
-     */
188
-    public $ROOT_OWNER_MEMBER_EMAIL;
189
-
190
-    /** @var string $ROOT_OWNER_MEMBER_API_KEY
191
-     * Root owner member API key.
192
-     */
193
-    public $ROOT_OWNER_MEMBER_API_KEY;
194
-
195
-    /** @var string $geocodingMethod
196
-     * Geocoding method
197
-     */
198
-    public $geocodingMethod;
199
-
200
-    /** @var string $service_type
201
-     * Service type (e.g. 'pre5').
202
-     */
203
-    public $service_type;
204
-
205
-    /** @var string $validated_by
206
-     * Validated by (e.g. 'ADMIN_PANEL').
207
-     */
208
-    public $validated_by;
209
-
210
-    /** @var int $max_stops_per_route
211
-     * Maximum allowed number of the stops per route.
212
-     */
213
-    public $max_stops_per_route;
214
-
215
-    /** @var int $max_routes
216
-     * Maximum allowed number of the generated routes.
217
-     */
218
-    public $max_routes;
219
-
220
-    /** @var int $max_route
221
-     * Maximum allowed number of the generated routes.
222
-     */
223
-    public $max_route;
224
-
225
-    /** @var int $route_planned
226
-     * Planned route numbers
227
-     */
228
-    public $route_planned;
229
-
230
-    /** @var int $routes_planned
231
-     * Routes Planned
232
-     */
233
-    public $routes_planned;
234
-
235
-    /** @var int $total_routes_planned
236
-     * Total planned routes.
237
-     */
238
-    public $total_routes_planned;
239
-
240
-    /** @var int $authentication_count
241
-     * Authentication count.
242
-     */
243
-    public $authentication_count;
244
-
245
-    /** @var string $salesforce_unique_record_id
246
-     * Salesforce unique record ID.
247
-     */
248
-    public $salesforce_unique_record_id;
249
-
250
-    /** @var string $salesforce_account_id
251
-     * Salesforce account ID
252
-     */
253
-    public $salesforce_account_id;
254
-
255
-    /** @var string $salesforce_lead_id
256
-     * Salesforce lead ID
257
-     */
258
-    public $salesforce_lead_id;
259
-
260
-    /** @var int $max_api_optimization_addresses
261
-     * The maximun number of addresses the authenticated user
262
-     * can optimize in this billing cycle.
263
-     */
264
-    public $max_api_optimization_addresses;
265
-
266
-    /** @var int $max_api_geocoding_addresses
267
-     * The maximun number of geocodings the authenticated user
268
-     * can optimize in this billing cycle.
269
-     */
270
-    public $max_api_geocoding_addresses;
271
-
272
-    /** @var int $max_api_directions_addresses
273
-     * The maximum number of driving route transactions the authenticated
274
-     * user can execute in this billing cycle.
275
-     */
276
-    public $max_api_directions_addresses;
277
-
278
-    /** @var int $max_api_validation_addresses
279
-     * The maximun number of address validation transactions the authenticated
280
-     * user can execute in this billing cycle.
281
-     */
282
-    public $max_api_validation_addresses;
283
-
284
-    /** @var int $max_stops_per_unoptimized_route
285
-     * The maximum number of stops the authenticated user
286
-     * can put into a route with optimization disabled.
287
-     */
288
-    public $max_stops_per_unoptimized_route;
289
-
290
-    /** @var int $max_api_distance_tx
291
-     * The maximum number of distance transactions the authenticated
292
-     * user can execute in this billing cycle.
293
-     */
294
-    public $max_api_distance_tx;
295
-
296
-    /** @var boolean $blDisplayUpgradeTrackingHTML
297
-     * Display upgrade tracking HTML.
298
-     */
299
-    public $blDisplayUpgradeTrackingHTML;
300
-
301
-    /** @var int $intTrackingTrigger
302
-     * Tracking trigger (int).
303
-     */
304
-    public $intTrackingTrigger;
305
-
306
-    /** @var int $last_payment_ts
307
-     * The last unix timestamp when this user was successfully charged.
308
-     */
309
-    public $last_payment_ts;
310
-
311
-    /** @var int $last_failed_payment_ts
312
-     * The last unix timestamp when this user was failed to pay.
313
-     */
314
-    public $last_failed_payment_ts;
315
-
316
-    /** @var int $account_expires_timestamp
317
-     * Account expire date
318
-     */
319
-    public $account_expires_timestamp;
320
-
321
-    /** @var boolean $account_past_due
322
-     * Account past due
323
-     */
324
-    public $account_past_due;
325
-
326
-    /** @var string $ui_input_method
327
-     * UI input method
328
-     */
329
-    public $ui_input_method;
330
-
331
-    /** @var string $registration_app
332
-     * Registration application
333
-     */
334
-    public $registration_app;
335
-
336
-    /** @var string $registration_device
337
-     * Registration device
338
-     */
339
-    public $registration_device;
340
-
341
-    /** @var string $preferred_units
342
-     * Preferred units (mi, km)
343
-     */
344
-    public $preferred_units;
345
-
346
-    /** @var string $preferred_language
347
-     * Preferred language (en, fr)
348
-     */
349
-    public $preferred_language;
350
-
351
-    /** @var string $hide_routed_addresses
352
-     * If true, routed addresses will be hidden.
353
-     */
354
-    public $hide_routed_addresses;
355
-
356
-    /** @var string $show_superuser_addresses
357
-     * Show superuser addresses ('0', '1').
358
-     */
359
-    public $show_superuser_addresses;
360
-
361
-    /** @var string $appdirect_url
362
-     * Application direction URL
363
-     */
364
-    public $appdirect_url;
365
-
366
-    /** @var int $timestamp_trial_expiration
367
-     * Timestamp trial expiration
368
-     */
369
-    public $timestamp_trial_expiration;
370
-
371
-    /** @var string $update_channel_name
372
-     * Update channel name
373
-     */
374
-    public $update_channel_name;
375
-
376
-    /** @var int $max_subusers_cnt
377
-     * Maximum subusers count
378
-     */
379
-    public $max_subusers_cnt;
380
-
381
-    /** @var string $hide_visited_addresses
382
-     * If true, visited addresses will be hidden.
383
-     */
384
-    public $hide_visited_addresses;
385
-
386
-    /** @var string $HIDE_NONFUTURE_ROUTES
387
-     * If true, nonfuture routes will be hidden.
388
-     */
389
-    public $HIDE_NONFUTURE_ROUTES;
390
-
391
-    /** @var string $display_max_routes_future_days
392
-     * Display maximum routes future days ('0', '1').
393
-     */
394
-    public $display_max_routes_future_days;
395
-
396
-    /** @var string $READONLY_USER
397
-     * Readonly uer ('0', '1').
398
-     */
399
-    public $READONLY_USER;
400
-
401
-    /** @var int $auto_logout_ts
402
-     * Time in seconds. A user will be logged out after been inactive during specified by this parameter seconds.
403
-     */
404
-    public $auto_logout_ts;
405
-
406
-    public static function fromArray(array $params)
407
-    {
408
-        $memberResponse = new self();
409
-
410
-        foreach ($params as $key => $value) {
411
-            if (property_exists($memberResponse, $key)) {
412
-                $memberResponse->{$key} = $value;
413
-            }
414
-        }
415
-
416
-        return $memberResponse;
417
-    }
12
+	/** @var boolean $authenticated
13
+	 * A boolean flag indicating if the session is valid.
14
+	 */
15
+	public $authenticated;
16
+
17
+	/** @var boolean $status
18
+	 * Process status
19
+	 */
20
+	public $status;
21
+
22
+	/** @var string $geocoding_service
23
+	 * Geocoding service
24
+	 */
25
+	public $geocoding_service;
26
+
27
+	/** @var string $session_id
28
+	 * The integer session id of the current session.
29
+	 */
30
+	public $session_id;
31
+
32
+	/** @var string $session_guid
33
+	 * An MD5 hash string of the currently authenticated sesssion,
34
+	 * important to use this with future requests.
35
+	 */
36
+	public $session_guid;
37
+
38
+	/** @var string $member_first_name
39
+	 * The first name of the user.
40
+	 */
41
+	public $member_first_name;
42
+
43
+	/** @var string $member_last_name
44
+	 * The last name of the user.
45
+	 */
46
+	public $member_last_name;
47
+
48
+	/** @var int $member_timestamp_added
49
+	 * The unix timestamp when the user joined the service.
50
+	 */
51
+	public $member_timestamp_added;
52
+
53
+	/** @var string $industry
54
+	 * The industry the authenticated user specified.
55
+	 */
56
+	public $industry;
57
+
58
+	/** @var int $member_id
59
+	 * Member ID
60
+	 */
61
+	public $member_id;
62
+
63
+	/** @var string $member_email
64
+	 * Member email
65
+	 */
66
+	public $member_email;
67
+
68
+	/** @var boolean $is_trial
69
+	 * If the user is currently a trial customer.
70
+	 */
71
+	public $is_trial;
72
+
73
+	/** @var boolean $is_active
74
+	 * If the user is currently an active customer.
75
+	 */
76
+	public $is_active;
77
+
78
+	/** @var string $api_key
79
+	 * User's API key
80
+	 */
81
+	public $api_key;
82
+
83
+	/** @var int $tracking_ttl
84
+	 * Tracking TTL
85
+	 */
86
+	public $tracking_ttl;
87
+
88
+	/** @var boolean $hide_billing_section
89
+	 * Hide billing section.
90
+	 */
91
+	public $hide_billing_section;
92
+
93
+	/** @var string $last_known_member_payment_device
94
+	 * Last known member payment device (e.g. 'web').
95
+	 */
96
+	public $last_known_member_payment_device;
97
+
98
+	/** @var array $licensed_modules
99
+	 * Licensed module. e.g.:
100
+	 * 'MODULE__ROUTE_EDITOR_CUSTOM_DATA_EDITING',
101
+	 * 'MODULE__VOICE_NAVIGATION:TRUE',
102
+	 * 'MODULE__VOICE_NAVIGATION'
103
+	 */
104
+	public $licensed_modules;
105
+
106
+	/** @var boolean $member_business_type
107
+	 * Member business type (e.g. 'BUSINESS_EMPLOYEE').
108
+	 */
109
+	public $member_business_type;
110
+
111
+	/** @var string $geofence_polygon_shape
112
+	 * Geofence polygon shape. Available values:
113
+	 * 'circle', 'poly', 'rect'.
114
+	 */
115
+	public $geofence_polygon_shape;
116
+
117
+	/** @var int $geofence_polygon_size
118
+	 * Geofence polygon size
119
+	 */
120
+	public $geofence_polygon_size;
121
+
122
+	/** @var int $geofence_time_onsite_trigger_secs
123
+	 * Geofence onsite trigger time (seconds).
124
+	 */
125
+	public $geofence_time_onsite_trigger_secs;
126
+
127
+	/** @var int $geofence_minimum_trigger_speed
128
+	 * Geofence's minimum trigger speed.
129
+	 */
130
+	public $geofence_minimum_trigger_speed;
131
+
132
+	/** @var bool $is_subscription_past_due
133
+	 * True if the subscription is past due.
134
+	 */
135
+	public $is_subscription_past_due;
136
+
137
+	/** @var string $visited_departed_enabled
138
+	 * If true, triggering of the visited and departed activities is enabled.
139
+	 */
140
+	public $visited_departed_enabled;
141
+
142
+	/** @var string $long_press_enabled
143
+	 * If true, long press is enabled.
144
+	 */
145
+	public $long_press_enabled;
146
+
147
+	/** @var int $account_type_id
148
+	 * The account type ID.
149
+	 */
150
+	public $account_type_id;
151
+
152
+	/** @var string $current_price
153
+	 * Current price (e.g. '0.000').
154
+	 */
155
+	public $current_price;
156
+
157
+	/** @var int $initially_requested_account_type_id
158
+	 * Initially Requested account type ID.
159
+	 */
160
+	public $initially_requested_account_type_id;
161
+
162
+	/** @var string $account_type_alias
163
+	 * Account type alias
164
+	 */
165
+	public $account_type_alias;
166
+
167
+	/** @var string $member_type
168
+	 * Member type. Available values:
169
+	 * PRIMARY_ACCOUNT, SUB_ACCOUNT_ADMIN, SUB_ACCOUNT_REGIONAL_MANAGER,
170
+	 * SUB_ACCOUNT_DISPATCHER, SUB_ACCOUNT_PLANNER, SUB_ACCOUNT_DRIVER,
171
+	 * SUB_ACCOUNT_ANALYSTSUB_ACCOUNT_VENDORSUB_ACCOUNT_CUSTOMER_SERVICE
172
+	 */
173
+	public $member_type;
174
+
175
+	/** @var string $OWNER_MEMBER_ID
176
+	 * Parent user ID.
177
+	 */
178
+	public $OWNER_MEMBER_ID;
179
+
180
+	/** @var string $ROOT_OWNER_MEMBER_ID
181
+	 * Root owner member ID (e.g. '402088').
182
+	 */
183
+	public $ROOT_OWNER_MEMBER_ID;
184
+
185
+	/** @var string $ROOT_OWNER_MEMBER_EMAIL
186
+	 * Root owner member email.
187
+	 */
188
+	public $ROOT_OWNER_MEMBER_EMAIL;
189
+
190
+	/** @var string $ROOT_OWNER_MEMBER_API_KEY
191
+	 * Root owner member API key.
192
+	 */
193
+	public $ROOT_OWNER_MEMBER_API_KEY;
194
+
195
+	/** @var string $geocodingMethod
196
+	 * Geocoding method
197
+	 */
198
+	public $geocodingMethod;
199
+
200
+	/** @var string $service_type
201
+	 * Service type (e.g. 'pre5').
202
+	 */
203
+	public $service_type;
204
+
205
+	/** @var string $validated_by
206
+	 * Validated by (e.g. 'ADMIN_PANEL').
207
+	 */
208
+	public $validated_by;
209
+
210
+	/** @var int $max_stops_per_route
211
+	 * Maximum allowed number of the stops per route.
212
+	 */
213
+	public $max_stops_per_route;
214
+
215
+	/** @var int $max_routes
216
+	 * Maximum allowed number of the generated routes.
217
+	 */
218
+	public $max_routes;
219
+
220
+	/** @var int $max_route
221
+	 * Maximum allowed number of the generated routes.
222
+	 */
223
+	public $max_route;
224
+
225
+	/** @var int $route_planned
226
+	 * Planned route numbers
227
+	 */
228
+	public $route_planned;
229
+
230
+	/** @var int $routes_planned
231
+	 * Routes Planned
232
+	 */
233
+	public $routes_planned;
234
+
235
+	/** @var int $total_routes_planned
236
+	 * Total planned routes.
237
+	 */
238
+	public $total_routes_planned;
239
+
240
+	/** @var int $authentication_count
241
+	 * Authentication count.
242
+	 */
243
+	public $authentication_count;
244
+
245
+	/** @var string $salesforce_unique_record_id
246
+	 * Salesforce unique record ID.
247
+	 */
248
+	public $salesforce_unique_record_id;
249
+
250
+	/** @var string $salesforce_account_id
251
+	 * Salesforce account ID
252
+	 */
253
+	public $salesforce_account_id;
254
+
255
+	/** @var string $salesforce_lead_id
256
+	 * Salesforce lead ID
257
+	 */
258
+	public $salesforce_lead_id;
259
+
260
+	/** @var int $max_api_optimization_addresses
261
+	 * The maximun number of addresses the authenticated user
262
+	 * can optimize in this billing cycle.
263
+	 */
264
+	public $max_api_optimization_addresses;
265
+
266
+	/** @var int $max_api_geocoding_addresses
267
+	 * The maximun number of geocodings the authenticated user
268
+	 * can optimize in this billing cycle.
269
+	 */
270
+	public $max_api_geocoding_addresses;
271
+
272
+	/** @var int $max_api_directions_addresses
273
+	 * The maximum number of driving route transactions the authenticated
274
+	 * user can execute in this billing cycle.
275
+	 */
276
+	public $max_api_directions_addresses;
277
+
278
+	/** @var int $max_api_validation_addresses
279
+	 * The maximun number of address validation transactions the authenticated
280
+	 * user can execute in this billing cycle.
281
+	 */
282
+	public $max_api_validation_addresses;
283
+
284
+	/** @var int $max_stops_per_unoptimized_route
285
+	 * The maximum number of stops the authenticated user
286
+	 * can put into a route with optimization disabled.
287
+	 */
288
+	public $max_stops_per_unoptimized_route;
289
+
290
+	/** @var int $max_api_distance_tx
291
+	 * The maximum number of distance transactions the authenticated
292
+	 * user can execute in this billing cycle.
293
+	 */
294
+	public $max_api_distance_tx;
295
+
296
+	/** @var boolean $blDisplayUpgradeTrackingHTML
297
+	 * Display upgrade tracking HTML.
298
+	 */
299
+	public $blDisplayUpgradeTrackingHTML;
300
+
301
+	/** @var int $intTrackingTrigger
302
+	 * Tracking trigger (int).
303
+	 */
304
+	public $intTrackingTrigger;
305
+
306
+	/** @var int $last_payment_ts
307
+	 * The last unix timestamp when this user was successfully charged.
308
+	 */
309
+	public $last_payment_ts;
310
+
311
+	/** @var int $last_failed_payment_ts
312
+	 * The last unix timestamp when this user was failed to pay.
313
+	 */
314
+	public $last_failed_payment_ts;
315
+
316
+	/** @var int $account_expires_timestamp
317
+	 * Account expire date
318
+	 */
319
+	public $account_expires_timestamp;
320
+
321
+	/** @var boolean $account_past_due
322
+	 * Account past due
323
+	 */
324
+	public $account_past_due;
325
+
326
+	/** @var string $ui_input_method
327
+	 * UI input method
328
+	 */
329
+	public $ui_input_method;
330
+
331
+	/** @var string $registration_app
332
+	 * Registration application
333
+	 */
334
+	public $registration_app;
335
+
336
+	/** @var string $registration_device
337
+	 * Registration device
338
+	 */
339
+	public $registration_device;
340
+
341
+	/** @var string $preferred_units
342
+	 * Preferred units (mi, km)
343
+	 */
344
+	public $preferred_units;
345
+
346
+	/** @var string $preferred_language
347
+	 * Preferred language (en, fr)
348
+	 */
349
+	public $preferred_language;
350
+
351
+	/** @var string $hide_routed_addresses
352
+	 * If true, routed addresses will be hidden.
353
+	 */
354
+	public $hide_routed_addresses;
355
+
356
+	/** @var string $show_superuser_addresses
357
+	 * Show superuser addresses ('0', '1').
358
+	 */
359
+	public $show_superuser_addresses;
360
+
361
+	/** @var string $appdirect_url
362
+	 * Application direction URL
363
+	 */
364
+	public $appdirect_url;
365
+
366
+	/** @var int $timestamp_trial_expiration
367
+	 * Timestamp trial expiration
368
+	 */
369
+	public $timestamp_trial_expiration;
370
+
371
+	/** @var string $update_channel_name
372
+	 * Update channel name
373
+	 */
374
+	public $update_channel_name;
375
+
376
+	/** @var int $max_subusers_cnt
377
+	 * Maximum subusers count
378
+	 */
379
+	public $max_subusers_cnt;
380
+
381
+	/** @var string $hide_visited_addresses
382
+	 * If true, visited addresses will be hidden.
383
+	 */
384
+	public $hide_visited_addresses;
385
+
386
+	/** @var string $HIDE_NONFUTURE_ROUTES
387
+	 * If true, nonfuture routes will be hidden.
388
+	 */
389
+	public $HIDE_NONFUTURE_ROUTES;
390
+
391
+	/** @var string $display_max_routes_future_days
392
+	 * Display maximum routes future days ('0', '1').
393
+	 */
394
+	public $display_max_routes_future_days;
395
+
396
+	/** @var string $READONLY_USER
397
+	 * Readonly uer ('0', '1').
398
+	 */
399
+	public $READONLY_USER;
400
+
401
+	/** @var int $auto_logout_ts
402
+	 * Time in seconds. A user will be logged out after been inactive during specified by this parameter seconds.
403
+	 */
404
+	public $auto_logout_ts;
405
+
406
+	public static function fromArray(array $params)
407
+	{
408
+		$memberResponse = new self();
409
+
410
+		foreach ($params as $key => $value) {
411
+			if (property_exists($memberResponse, $key)) {
412
+				$memberResponse->{$key} = $value;
413
+			}
414
+		}
415
+
416
+		return $memberResponse;
417
+	}
418 418
 
419 419
 }
420 420
\ No newline at end of file
Please login to merge, or discard this patch.