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 Setup Failed
Push — master ( 859c79...16ec0a )
by Igor
12:08 queued 05:53
created
src/Route4Me/CustomNoteType.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -9,32 +9,32 @@
 block discarded – undo
9 9
  */
10 10
 class CustomNoteType extends Common
11 11
 {
12
-    /**
13
-     * Note custom entry ID
14
-     * @var integer
15
-     */
16
-    public $note_custom_entry_id;
12
+	/**
13
+	 * Note custom entry ID
14
+	 * @var integer
15
+	 */
16
+	public $note_custom_entry_id;
17 17
 
18
-    /**
19
-     * Note ID
20
-     * @var integer
21
-     */
22
-    public $note_id;
18
+	/**
19
+	 * Note ID
20
+	 * @var integer
21
+	 */
22
+	public $note_id;
23 23
 
24
-    /**
25
-     * Note custom type ID
26
-     * @var integer
27
-     */
28
-    public $note_custom_type_id;
24
+	/**
25
+	 * Note custom type ID
26
+	 * @var integer
27
+	 */
28
+	public $note_custom_type_id;
29 29
 
30
-    /**
31
-     * The value of a note custom type
32
-     * @var string
33
-     */
34
-    public $note_custom_value;
30
+	/**
31
+	 * The value of a note custom type
32
+	 * @var string
33
+	 */
34
+	public $note_custom_value;
35 35
 
36
-    /**
37
-     * Note custom type
38
-     */
39
-    public $note_custom_type;
36
+	/**
37
+	 * Note custom type
38
+	 */
39
+	public $note_custom_type;
40 40
 }
Please login to merge, or discard this patch.
src/Route4Me/DirectionStep.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -11,63 +11,63 @@
 block discarded – undo
11 11
  */
12 12
 class DirectionStep extends Common
13 13
 {
14
-    /**
15
-     * Name (detailed)
16
-     * @var string
17
-     */
18
-    public $direction;
14
+	/**
15
+	 * Name (detailed)
16
+	 * @var string
17
+	 */
18
+	public $direction;
19 19
 
20
-    /**
21
-     * Name (brief)
22
-     * @var strng
23
-     */
24
-    public $directions;
20
+	/**
21
+	 * Name (brief)
22
+	 * @var strng
23
+	 */
24
+	public $directions;
25 25
 
26
-    /**
27
-     * Distance
28
-     * @var double
29
-     */
30
-    public $distance;
26
+	/**
27
+	 * Distance
28
+	 * @var double
29
+	 */
30
+	public $distance;
31 31
 
32
-    /**
33
-     * Distance unit
34
-     * @var string
35
-     */
36
-    public $distance_unit;
32
+	/**
33
+	 * Distance unit
34
+	 * @var string
35
+	 */
36
+	public $distance_unit;
37 37
 
38
-    /**
39
-     * Maneuver Type. Available values:
40
-     * - Head,Go Straight,Turn Left,Turn Right,Turn Slight Left,
41
-     * - Turn Slight Right,Turn Sharp Left,Turn Sharp Right,
42
-     * - Roundabout Left,Roundabout Right,Uturn Left,Uturn Right,
43
-     * - Ramp Left,Ramp Right,Fork Left,Fork Right,Keep Left,
44
-     * - Keep Right,Ferry,Ferry Train,Merge,Reached Your Destination.
45
-     * @var string
46
-     */
47
-    public $maneuverType;
38
+	/**
39
+	 * Maneuver Type. Available values:
40
+	 * - Head,Go Straight,Turn Left,Turn Right,Turn Slight Left,
41
+	 * - Turn Slight Right,Turn Sharp Left,Turn Sharp Right,
42
+	 * - Roundabout Left,Roundabout Right,Uturn Left,Uturn Right,
43
+	 * - Ramp Left,Ramp Right,Fork Left,Fork Right,Keep Left,
44
+	 * - Keep Right,Ferry,Ferry Train,Merge,Reached Your Destination.
45
+	 * @var string
46
+	 */
47
+	public $maneuverType;
48 48
 
49
-    /**
50
-     * Compass Direction. Available values:<br>
51
-     *  N, S, W, E, NW, NE, SW, SE
52
-     * @var string
53
-     */
54
-    public $compass_direction;
49
+	/**
50
+	 * Compass Direction. Available values:<br>
51
+	 *  N, S, W, E, NW, NE, SW, SE
52
+	 * @var string
53
+	 */
54
+	public $compass_direction;
55 55
 
56
-    /**
57
-     * UDU Distance (UDU: User Distance Unit).
58
-     * @var double
59
-     */
60
-    public $udu_distance;
56
+	/**
57
+	 * UDU Distance (UDU: User Distance Unit).
58
+	 * @var double
59
+	 */
60
+	public $udu_distance;
61 61
 
62
-    /**
63
-     * Direction step duration(seconds)
64
-     * @var integer
65
-     */
66
-    public $duration_sec;
62
+	/**
63
+	 * Direction step duration(seconds)
64
+	 * @var integer
65
+	 */
66
+	public $duration_sec;
67 67
 
68
-    /**
69
-     * Maneuver Point
70
-     * @var GeoPoint
71
-     */
72
-    public $maneuverPoint;
68
+	/**
69
+	 * Maneuver Point
70
+	 * @var GeoPoint
71
+	 */
72
+	public $maneuverPoint;
73 73
 }
Please login to merge, or discard this patch.
src/Route4Me/GeoPoint.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@
 block discarded – undo
11 11
  */
12 12
 class GeoPoint extends Common
13 13
 {
14
-    /**
15
-     * Latitude
16
-     * @var double
17
-     */
18
-    public $lat;
14
+	/**
15
+	 * Latitude
16
+	 * @var double
17
+	 */
18
+	public $lat;
19 19
 
20
-    /**
21
-     * Longitude
22
-     * @var double
23
-     */
24
-    public $lng;
20
+	/**
21
+	 * Longitude
22
+	 * @var double
23
+	 */
24
+	public $lng;
25 25
 }
Please login to merge, or discard this patch.
src/Route4Me/Geocoding.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -6,96 +6,96 @@
 block discarded – undo
6 6
 
7 7
 class Geocoding extends Common
8 8
 {
9
-    public $strExportFormat;
10
-    public $format;
11
-    public $addresses;
12
-    public $pk;
13
-    public $offset;
14
-    public $limit;
15
-    public $housenumber;
16
-    public $zipcode;
9
+	public $strExportFormat;
10
+	public $format;
11
+	public $addresses;
12
+	public $pk;
13
+	public $offset;
14
+	public $limit;
15
+	public $housenumber;
16
+	public $zipcode;
17 17
 
18
-    public static function forwardGeocoding($params)
19
-    {
20
-        $allBodyFields = ['strExportFormat', 'addresses'];
18
+	public static function forwardGeocoding($params)
19
+	{
20
+		$allBodyFields = ['strExportFormat', 'addresses'];
21 21
 
22
-        $fgCoding = Route4Me::makeRequst([
23
-            'url'           => Endpoint::GEOCODER,
24
-            'method'        => 'POST',
25
-            'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
26
-            'HTTPHEADER'    => 'Content-Type: multipart/form-data',
27
-        ]);
22
+		$fgCoding = Route4Me::makeRequst([
23
+			'url'           => Endpoint::GEOCODER,
24
+			'method'        => 'POST',
25
+			'body'          => Route4Me::generateRequestParameters($allBodyFields, $params),
26
+			'HTTPHEADER'    => 'Content-Type: multipart/form-data',
27
+		]);
28 28
 
29
-        return $fgCoding;
30
-    }
29
+		return $fgCoding;
30
+	}
31 31
 
32
-    public static function reverseGeocoding($params)
33
-    {
34
-        $allQueryFields = ['format', 'addresses', 'detailed'];
32
+	public static function reverseGeocoding($params)
33
+	{
34
+		$allQueryFields = ['format', 'addresses', 'detailed'];
35 35
 
36
-        $fgcoding = Route4Me::makeRequst([
37
-            'url'       => Endpoint::GEOCODER,
38
-            'method'    => 'POST',
39
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
40
-        ]);
36
+		$fgcoding = Route4Me::makeRequst([
37
+			'url'       => Endpoint::GEOCODER,
38
+			'method'    => 'POST',
39
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
40
+		]);
41 41
 
42
-        return $fgcoding;
43
-    }
42
+		return $fgcoding;
43
+	}
44 44
 
45
-    public static function getStreetData($params)
46
-    {
47
-        Route4Me::setBaseUrl(Endpoint::STREET_DATA);
45
+	public static function getStreetData($params)
46
+	{
47
+		Route4Me::setBaseUrl(Endpoint::STREET_DATA);
48 48
 
49
-        $allPathFields = ['pk', 'offset', 'limit'];
49
+		$allPathFields = ['pk', 'offset', 'limit'];
50 50
 
51
-        $url_query = Route4Me::generateUrlPath($allPathFields, $params);
51
+		$url_query = Route4Me::generateUrlPath($allPathFields, $params);
52 52
 
53
-        $query = [];
53
+		$query = [];
54 54
 
55
-        $response = Route4Me::makeRequst([
56
-            'url'       => $url_query,
57
-            'method'    => 'GET',
58
-            'query'     => $query,
59
-        ]);
55
+		$response = Route4Me::makeRequst([
56
+			'url'       => $url_query,
57
+			'method'    => 'GET',
58
+			'query'     => $query,
59
+		]);
60 60
 
61
-        return $response;
62
-    }
61
+		return $response;
62
+	}
63 63
 
64
-    public static function getZipCode($params)
65
-    {
66
-        Route4Me::setBaseUrl(Endpoint::STREET_DATA_ZIPCODE);
64
+	public static function getZipCode($params)
65
+	{
66
+		Route4Me::setBaseUrl(Endpoint::STREET_DATA_ZIPCODE);
67 67
 
68
-        $allPathFields = ['zipcode', 'offset', 'limit'];
68
+		$allPathFields = ['zipcode', 'offset', 'limit'];
69 69
 
70
-        $url_query = Route4Me::generateUrlPath($allPathFields, $params);
70
+		$url_query = Route4Me::generateUrlPath($allPathFields, $params);
71 71
 
72
-        $query = [];
72
+		$query = [];
73 73
 
74
-        $response = Route4Me::makeRequst([
75
-            'url'       => $url_query,
76
-            'method'    => 'GET',
77
-            'query'     => $query,
78
-        ]);
74
+		$response = Route4Me::makeRequst([
75
+			'url'       => $url_query,
76
+			'method'    => 'GET',
77
+			'query'     => $query,
78
+		]);
79 79
 
80
-        return $response;
81
-    }
80
+		return $response;
81
+	}
82 82
 
83
-    public static function getService($params)
84
-    {
85
-        Route4Me::setBaseUrl(Endpoint::STREET_DATA_SERVICE);
83
+	public static function getService($params)
84
+	{
85
+		Route4Me::setBaseUrl(Endpoint::STREET_DATA_SERVICE);
86 86
 
87
-        $allPathFields = ['zipcode', 'housenumber', 'offset', 'limit'];
87
+		$allPathFields = ['zipcode', 'housenumber', 'offset', 'limit'];
88 88
 
89
-        $url_query = Route4Me::generateUrlPath($allPathFields, $params);
89
+		$url_query = Route4Me::generateUrlPath($allPathFields, $params);
90 90
 
91
-        $query = [];
91
+		$query = [];
92 92
 
93
-        $response = Route4Me::makeRequst([
94
-            'url'       => $url_query,
95
-            'method'    => 'GET',
96
-            'query'     => $query,
97
-        ]);
93
+		$response = Route4Me::makeRequst([
94
+			'url'       => $url_query,
95
+			'method'    => 'GET',
96
+			'query'     => $query,
97
+		]);
98 98
 
99
-        return $response;
100
-    }
99
+		return $response;
100
+	}
101 101
 }
Please login to merge, or discard this patch.
src/Route4Me/ScheduleCalendarParameters.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -9,85 +9,85 @@
 block discarded – undo
9 9
  */
10 10
 class ScheduleCalendarParameters extends Common
11 11
 {
12
-    /**
13
-     * Start date to filter the schedules in the string format<br>
14
-     * (e.g. 2020-10-27).
15
-     * @var string
16
-     */
17
-    public $date_from_string;
12
+	/**
13
+	 * Start date to filter the schedules in the string format<br>
14
+	 * (e.g. 2020-10-27).
15
+	 * @var string
16
+	 */
17
+	public $date_from_string;
18 18
 
19
-    /**
20
-     * End date to filter the schedules in the string format<br>
21
-     * (e.g. 2020-10-30).
22
-     * @var string
23
-     */
24
-    public $date_to_string;
19
+	/**
20
+	 * End date to filter the schedules in the string format<br>
21
+	 * (e.g. 2020-10-30).
22
+	 * @var string
23
+	 */
24
+	public $date_to_string;
25 25
 
26
-    /**
27
-     * Member ID
28
-     * @var integer
29
-     */
30
-    public $member_id;
26
+	/**
27
+	 * Member ID
28
+	 * @var integer
29
+	 */
30
+	public $member_id;
31 31
 
32
-    /**
33
-     * Timezone offset (in minutes)<br>
34
-     * (e.g. NYT: -4*60 = -480, Kiev: 3*60 = 180).
35
-     * @var integer
36
-     */
37
-    public $timezone_offset_minutes;
32
+	/**
33
+	 * Timezone offset (in minutes)<br>
34
+	 * (e.g. NYT: -4*60 = -480, Kiev: 3*60 = 180).
35
+	 * @var integer
36
+	 */
37
+	public $timezone_offset_minutes;
38 38
 
39
-    /**
40
-     * If true, the scheduled orders are included in the calendar.
41
-     * @var Boolean
42
-     */
43
-    public $orders;
39
+	/**
40
+	 * If true, the scheduled orders are included in the calendar.
41
+	 * @var Boolean
42
+	 */
43
+	public $orders;
44 44
 
45
-    /**
46
-     * If true, the scheduled address book contacts
47
-     * are included in the calendar.
48
-     * @var Boolean
49
-     */
50
-    public $ab;
45
+	/**
46
+	 * If true, the scheduled address book contacts
47
+	 * are included in the calendar.
48
+	 * @var Boolean
49
+	 */
50
+	public $ab;
51 51
 
52
-    /**
53
-     * If true, the scheduled routes are included in the calendar.
54
-     * @var Boolean
55
-     */
56
-    public $routes_count;
52
+	/**
53
+	 * If true, the scheduled routes are included in the calendar.
54
+	 * @var Boolean
55
+	 */
56
+	public $routes_count;
57 57
 
58
-    /**
59
-     * Class constructor.
60
-     * @var
61
-     */
62
-    public function __construct()
63
-    {
64
-        Route4Me::setBaseUrl(Endpoint::BASE_URL);
65
-    }
58
+	/**
59
+	 * Class constructor.
60
+	 * @var
61
+	 */
62
+	public function __construct()
63
+	{
64
+		Route4Me::setBaseUrl(Endpoint::BASE_URL);
65
+	}
66 66
 
67
-    public function setTimezoneOffsetMinutes($tz)
68
-    {
69
-        $this->timezone_offset_minutes = -$tz;
70
-    }
67
+	public function setTimezoneOffsetMinutes($tz)
68
+	{
69
+		$this->timezone_offset_minutes = -$tz;
70
+	}
71 71
 
72
-    public function getTimezoneOffsetMinutes()
73
-    {
74
-        if (is_numeric($this->timezone_offset_minutes)) {
75
-            return -$this->timezone_offset_minutes;
76
-        } else {
77
-            return 0;
78
-        }
79
-    }
72
+	public function getTimezoneOffsetMinutes()
73
+	{
74
+		if (is_numeric($this->timezone_offset_minutes)) {
75
+			return -$this->timezone_offset_minutes;
76
+		} else {
77
+			return 0;
78
+		}
79
+	}
80 80
 
81
-    public function getScheduleCalendar($params)
82
-    {
83
-        $allQueryFields = ['date_from_string', 'date_to_string', 'member_id', 'timezone_offset_minutes', 'orders', 'ab', 'routes_count'];
81
+	public function getScheduleCalendar($params)
82
+	{
83
+		$allQueryFields = ['date_from_string', 'date_to_string', 'member_id', 'timezone_offset_minutes', 'orders', 'ab', 'routes_count'];
84 84
 
85
-        $schedCalendar = Route4Me::makeRequst([
86
-            'url'       => Endpoint::SCHEDULE_CALENDAR,
87
-            'method'    => 'GET',
88
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
89
-        ]);
85
+		$schedCalendar = Route4Me::makeRequst([
86
+			'url'       => Endpoint::SCHEDULE_CALENDAR,
87
+			'method'    => 'GET',
88
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
89
+		]);
90 90
 
91
-        return $schedCalendar;
92
-    }
91
+		return $schedCalendar;
92
+	}
93 93
 }
Please login to merge, or discard this patch.
src/Route4Me/RouteParameters.php 1 patch
Indentation   +516 added lines, -516 removed lines patch added patch discarded remove patch
@@ -11,520 +11,520 @@
 block discarded – undo
11 11
  */
12 12
 class RouteParameters extends Common
13 13
 {
14
-    /**
15
-     * Let the R4M API know if this SDK request is comming
16
-     * from a file upload within your environment (for analytics).
17
-     * @var Boolean
18
-     */
19
-    public $is_upload;
20
-
21
-    /**
22
-     * The tour type of this route. rt is short for round trip,
23
-     * the optimization engine changes its behavior for round trip
24
-     * @var Boolean
25
-     */
26
-    public $rt;
27
-
28
-    /**
29
-     * The name of this route. this route name will be accessible in the search API,
30
-     * and also will be displayed on the mobile device of a user.
31
-     * @var string
32
-     */
33
-    public $route_name;
34
-
35
-    /**
36
-     * The route start date in UTC, unix timestamp seconds.
37
-     * Used to show users when the route will begin, also used for reporting and analytics.
38
-     * @var integer
39
-     */
40
-    public $route_date;
41
-
42
-    /**
43
-     * Offset in seconds relative to the route start date (i.e. 9AM would be 60 * 60 * 9)
44
-     * @var integer
45
-     */
46
-    public $route_time;
47
-
48
-    /**
49
-     * @deprecated 'Always false'
50
-     * @var string
51
-     */
52
-    public $shared_publicly;
53
-
54
-    /**
55
-     * By disabling optimization, the route optimization engine
56
-     * will not resequence the stops in your.
57
-     * @var disable_optimization
58
-     */
59
-    public $disable_optimization;
60
-
61
-    /**
62
-     * Gets or sets the optimize parameter.<br>
63
-     * Availabale values:
64
-     * - Distance,
65
-     * - Time,
66
-     * - timeWithTraffic
67
-     * @var string
68
-     */
69
-    public $optimize;
70
-
71
-    /**
72
-     * When the tour type is not round trip (rt = false),
73
-     * enable lock last so that the final destination is fixed.
74
-     * @var Boolean
75
-     */
76
-    public $lock_last;
77
-
78
-    /**
79
-     * Vehicle capacity.
80
-     * @var integer
81
-     */
82
-    public $vehicle_capacity;
83
-
84
-    /**
85
-     * Maximum distance for a single vehicle in the route (always in miles)
86
-     * @var integer
87
-     */
88
-    public $vehicle_max_distance_mi;
89
-
90
-    /**
91
-     * The distance measurement unit for the route.
92
-     * km or mi, the route4me api will convert all measurements into these units.
93
-     * @var string
94
-     */
95
-    public $distance_unit;
96
-
97
-    /**
98
-     * The mode of travel that the directions should be optimized for.<br>
99
-     *  Available values:
100
-     * - Driving
101
-     * - Walking
102
-     * @var string
103
-     */
104
-    public $travel_mode;
105
-
106
-    /**
107
-     * Options which let the user choose which road obstacles to avoid.<br>
108
-     * This has no impact on route sequencing.<br>
109
-     * Available values:
110
-     * - Highways
111
-     * - Tolls
112
-     * - minimizeHighways
113
-     * - minimizeTolls
114
-     * - highways,tolls
115
-     * - "".
116
-     * @var string
117
-     */
118
-    public $avoid;
119
-
120
-    /**
121
-     * The vehicle ID
122
-     * @var string
123
-     */
124
-    public $vehicle_id;
125
-
126
-    /**
127
-     * The latitude of the device making this sdk request.
128
-     * @var double
129
-     */
130
-    public $dev_lat;
131
-
132
-    /**
133
-     * The longitude of the device making this sdk request.
134
-     * @var double
135
-     */
136
-    public $dev_lng;
137
-
138
-    /**
139
-     * When using a multiple driver algorithm, this is the maximum permissible duration of a generated route.<br>
140
-     * The optimization system will automatically create more routes when the route_max_duration is exceeded for a route.<br>
141
-     * However it will create an 'unrouted' list of addresses if the maximum number of drivers is exceeded.
142
-     * @var long
143
-     */
144
-    public $route_max_duration;
145
-
146
-    /**
147
-     * The parameter specifies fine-tuning of an optimization process by route duration.
148
-     * @var double
149
-     */
150
-    public $target_duration;
151
-
152
-    /**
153
-     * The parameter specifies fine-tuning of an optimization process by route distance.
154
-     * @var double
155
-     */
156
-    public $target_distance;
157
-
158
-    /**
159
-     * The parameter specifies fine-tuning of an optimization process by waiting time.
160
-     * @var double
161
-     */
162
-    public $target_wait_by_tail_size;
163
-
164
-    /**
165
-     * The email address to notify upon completion of an optimization request.
166
-     * @var string
167
-     */
168
-    public $route_email;
169
-
170
-    /**
171
-     * @deprecated All routes are stored by default at this time
172
-     * @var
173
-     */
174
-    public $store_route = true;
175
-
176
-    /**
177
-     * Metric system
178
-     * @see Enum\Metric
179
-     * @var integer
180
-     */
181
-    public $metric;
182
-
183
-    /**
184
-     * The algorithm type to use when optimizing the route.
185
-     * @see Enum\AlgorithmType
186
-     * @var integer
187
-     */
188
-    public $algorithm_type;
189
-
190
-    /**
191
-     * The route owner's member ID.<br>
192
-     * In order for users in your organization to have routes assigned to them,
193
-     * you must provide their member ID within the Route4Me system.<br>
194
-     * A list of member IDs can be retrieved with view_users API method.
195
-     * @var integer
196
-     */
197
-    public $member_id;
198
-
199
-    /**
200
-     * Specify the ip address of the remote user making this optimization request.
201
-     * @var long
202
-     */
203
-    public $ip;
204
-
205
-    /**
206
-     * The method to use when compute the distance between the points in a route.<br>
207
-     * Available values: from 1 to 12.
208
-     * @var integer
209
-     */
210
-    public $dm;
211
-
212
-    /**
213
-     * Directions method.
214
-     * @var integer
215
-     */
216
-    public $dirm;
217
-
218
-    /**
219
-     * Legacy feature which permits a user to request an example number of optimized routes.
220
-     * @var integer
221
-     */
222
-    public $parts;
223
-
224
-    /**
225
-     * 32 Character MD5 String ID of the device that was used to plan this route.
226
-     * @deprecated Always null
227
-     * @var string
228
-     */
229
-    public $device_id;
230
-
231
-    /**
232
-     * The type of device making this request.
233
-     * @see Enum\DeviceType
234
-     * @var string
235
-     */
236
-    public $device_type;
237
-
238
-    /**
239
-     * If true, the vehicle has a trailer.<br>
240
-     * For routes that have trucking directions enabled, directions generated<br>
241
-     * will ensure compliance so that road directions generated do not take the vehicle
242
-     * where trailers are prohibited.
243
-     * @var Boolean
244
-     */
245
-    public $has_trailer;
246
-
247
-    /**
248
-     * The vehicle's trailer weight.<br>
249
-     * For routes that have trucking directions enabled, directions generated<br>
250
-     * will ensure compliance so that road directions generated do not take the vehicle<br>
251
-     * on roads where the weight of the vehicle in tons exceeds this value.
252
-     * @var double
253
-     */
254
-    public $trailer_weight_t;
255
-
256
-    /**
257
-     * If travel_mode is Trucking, specifies the truck weight.
258
-     * @var double
259
-     */
260
-    public $limited_weight_t;
261
-
262
-    /**
263
-     * The vehicle's weight per axle (tons)
264
-     * @var double
265
-     */
266
-    public $weight_per_axle_t;
267
-
268
-    /**
269
-     * Comma-delimited list of the truck hazardous goods.
270
-     * @var string
271
-     */
272
-    public $truck_hazardous_goods;
273
-
274
-    /**
275
-     * Truck axles number.
276
-     * @var integer
277
-     */
278
-    public $truck_axles;
279
-
280
-    /**
281
-     * Truck toll road usage. enum: ["YES", "NO"]
282
-     * @var string
283
-     */
284
-    public $truck_toll_road_usage;
285
-
286
-    /**
287
-     * Truck avoid ferries. enum: ["YES", "NO"]
288
-     * @var string
289
-     */
290
-    public $truck_avoid_ferries;
291
-
292
-    /**
293
-     * Truck highway only. enum: ["YES", "NO"]
294
-     * @var string
295
-     */
296
-    public $truck_hwy_only;
297
-
298
-    /**
299
-     * Truck of the type Long Combination Vehicle. enum: ["YES", "NO"]
300
-     * @var string
301
-     */
302
-    public $truck_lcv;
303
-
304
-    /**
305
-     * Avoid international borders. enum: ["YES", "NO"]
306
-     * @var string
307
-     */
308
-    public $truck_borders;
309
-
310
-    /**
311
-     * Truck side street adherence.<br>
312
-     *  enum: ["OFF", "MINIMAL","MODERATE","AVERAGE","STRICT","ADHERE","STRONGLYHERE"]
313
-     * @var string
314
-     */
315
-    public $truck_side_street_adherence;
316
-
317
-    /**
318
-     * Truck configuration.
319
-     * enum: ["NONE","PASSENGER","28_DOUBLETRAILER","48_STRAIGHT_TRUCK",
320
-     * "48_SEMI_TRAILER","53_SEMI_TRAILER","FULLSIZEVAN","26_STRAIGHT_TRUCK"]
321
-     * @var string
322
-     */
323
-    public $truck_config;
324
-
325
-    /**
326
-     * Truck dimension unit. enum: ["mi","km"]
327
-     * @var string
328
-     */
329
-    public $truck_dim_unit;
330
-
331
-    /**
332
-     * Truck type.
333
-     *  enum: ["suv","pickup_truck","van","18wheeler","cabin","waste_disposal",
334
-     * "tree_cutting","bigrig","cement_mixer","livestock_carrier","dairy", "tractor_trailer"]
335
-     * @var string
336
-     */
337
-    public $truck_type;
338
-
339
-    /**
340
-     * If travel_mode = 'Trucking', specifies the truck weight (required)
341
-     * @var double
342
-     */
343
-    public $truck_weight;
344
-
345
-    /**
346
-     * Maximum cargo weight a vehicle can cary.
347
-     * @var double
348
-     */
349
-    public $vehicle_max_cargo_weight;
350
-
351
-    /**
352
-     * Maximum cargo volume a vehicle can cary.
353
-     * @var double
354
-     */
355
-    public $vehicle_max_cargo_volume;
356
-
357
-    /**
358
-     * Maximum allowed revenue from a subtour.
359
-     * @var integer
360
-     */
361
-    public $subtour_max_revenue;
362
-
363
-    /**
364
-     * An array of the Avoidance zones IDs.
365
-     * @var string[]
366
-     */
367
-    public $avoidance_zones = [];
368
-
369
-    /**
370
-     * The vehicle ID, to be assigned to the route.
371
-     * @deprecated All new routes should be assigned to a member_id
372
-     * @var string
373
-     */
374
-    public $driver_id;
375
-
376
-    /**
377
-     * Minimum number of optimized routes.
378
-     * @var integer
379
-     */
380
-    public $parts_min;
381
-
382
-    /**
383
-     * If true, the vehicle will first drive then wait between stops.
384
-     * @var Boolean
385
-     */
386
-    public $first_drive_then_wait_between_stops;
387
-
388
-    /**
389
-     * The truck height.<br>
390
-     * For routes that have trucking directions enabled, directions generated<br>
391
-     * will ensure compliance of this maximum height of truck when generating
392
-     * road network driving directions.
393
-     * @var double
394
-     */
395
-    public $truck_height;
396
-
397
-    /**
398
-     * The truck width.<br>
399
-     * For routes that have trucking directions enabled, directions generated
400
-     * will ensure compliance of this width of the truck when generating road network
401
-     * driving directions.
402
-     * @var double
403
-     */
404
-    public $truck_width;
405
-
406
-    /**
407
-     * The truck length.<br>
408
-     * For routes that have trucking directions enabled, directions generated
409
-     * will ensure compliance of this length of the truck when generating
410
-     * road network driving directions.
411
-     * @var double
412
-     */
413
-    public $truck_length;
414
-
415
-    /**
416
-     * The optimization quality.<br>
417
-     * Available values:
418
-     * - 1 - Generate Optimized Routes As Quickly as Possible;
419
-     * - 2 - Generate Routes That Look Better On A Map;
420
-     * - 3 - Generate The Shortest And Quickest Possible Routes.
421
-     * @var integer
422
-     */
423
-    public $optimization_quality;
424
-
425
-    /**
426
-     * The maximum number of stops permitted per created subroute.
427
-     * @var integer
428
-     */
429
-    public $max_tour_size;
430
-
431
-    /**
432
-     * The minimum number of stops permitted per created subroute.
433
-     * @var integer
434
-     */
435
-    public $min_tour_size;
436
-
437
-    /**
438
-     * If equal to 1, uturn is allowed for the vehicle.
439
-     * @var integer
440
-     */
441
-    public $uturn;
442
-
443
-    /**
444
-     * If equal to 1, leftturn is allowed for the vehicle.
445
-     * @var integer
446
-     */
447
-    public $leftturn;
448
-
449
-    /**
450
-     * If equal to 1, rightturn is allowed for the vehicle.
451
-     * @var integer
452
-     */
453
-    public $rightturn;
454
-
455
-    /**
456
-     * Route travel time slowdown (e.g. 25 (means 25% slowdown)).
457
-     * @note the parameter is read-only and it can be set
458
-     * with the parameter Slowdowns.TravelTime.
459
-     * @var integer
460
-     */
461
-    public $route_time_multiplier;
462
-
463
-    /**
464
-     * Route service time slowdown (e.g. 10 (means 10% slowdown)).
465
-     * @note the parameter is read-only and it can be set
466
-     * with the parameter Slowdowns.TravelTime.
467
-     * @var integer
468
-     */
469
-    public $route_service_time_multiplier;
470
-
471
-    /**
472
-     * Optimization engine (e.g. '1','2' etc)
473
-     * @var string
474
-     */
475
-    public $optimization_engine;
476
-
477
-    /**
478
-     * Override addresses
479
-     * @var OverrideAddresses
480
-     */
481
-    public $override_addresses;
482
-
483
-    /**
484
-     * Address bundling rules
485
-     * @var V5\Addresses\AddressBundling
486
-     */
487
-    public $bundling;
488
-
489
-    /**
490
-     * Advanced route constraints
491
-     * @var RouteAdvancedConstraints
492
-     */
493
-    public $advanced_constraints = [];
494
-
495
-    /**
496
-     * If true, the time windows ignored.
497
-     * @var Boolean
498
-     */
499
-    public $ignore_tw;
500
-
501
-    /**
502
-     * If true, the start time is dynamic.
503
-     * @var Boolean
504
-     */
505
-    public $is_dynamic_start_time;
506
-
507
-    /**
508
-     * @deprecated The parameter 'route_type' isn't included in route parameters.
509
-     * @var string
510
-     */
511
-    public $route_type;
512
-
513
-    /**
514
-     * Slowdown of the optimization parameters.
515
-     * @note This is only query parameter.
516
-     * @note This parameter is used in the optimization creation/generation process.
517
-     * @var SlowdownParams
518
-     */
519
-    public $slowdowns;
520
-
521
-    public function setAddressBundle($addressBundle)
522
-    {
523
-        $this->bundling = $addressBundle;
524
-    }
525
-
526
-    public function getAddressBundle()
527
-    {
528
-        return $this->bundling;
529
-    }
14
+	/**
15
+	 * Let the R4M API know if this SDK request is comming
16
+	 * from a file upload within your environment (for analytics).
17
+	 * @var Boolean
18
+	 */
19
+	public $is_upload;
20
+
21
+	/**
22
+	 * The tour type of this route. rt is short for round trip,
23
+	 * the optimization engine changes its behavior for round trip
24
+	 * @var Boolean
25
+	 */
26
+	public $rt;
27
+
28
+	/**
29
+	 * The name of this route. this route name will be accessible in the search API,
30
+	 * and also will be displayed on the mobile device of a user.
31
+	 * @var string
32
+	 */
33
+	public $route_name;
34
+
35
+	/**
36
+	 * The route start date in UTC, unix timestamp seconds.
37
+	 * Used to show users when the route will begin, also used for reporting and analytics.
38
+	 * @var integer
39
+	 */
40
+	public $route_date;
41
+
42
+	/**
43
+	 * Offset in seconds relative to the route start date (i.e. 9AM would be 60 * 60 * 9)
44
+	 * @var integer
45
+	 */
46
+	public $route_time;
47
+
48
+	/**
49
+	 * @deprecated 'Always false'
50
+	 * @var string
51
+	 */
52
+	public $shared_publicly;
53
+
54
+	/**
55
+	 * By disabling optimization, the route optimization engine
56
+	 * will not resequence the stops in your.
57
+	 * @var disable_optimization
58
+	 */
59
+	public $disable_optimization;
60
+
61
+	/**
62
+	 * Gets or sets the optimize parameter.<br>
63
+	 * Availabale values:
64
+	 * - Distance,
65
+	 * - Time,
66
+	 * - timeWithTraffic
67
+	 * @var string
68
+	 */
69
+	public $optimize;
70
+
71
+	/**
72
+	 * When the tour type is not round trip (rt = false),
73
+	 * enable lock last so that the final destination is fixed.
74
+	 * @var Boolean
75
+	 */
76
+	public $lock_last;
77
+
78
+	/**
79
+	 * Vehicle capacity.
80
+	 * @var integer
81
+	 */
82
+	public $vehicle_capacity;
83
+
84
+	/**
85
+	 * Maximum distance for a single vehicle in the route (always in miles)
86
+	 * @var integer
87
+	 */
88
+	public $vehicle_max_distance_mi;
89
+
90
+	/**
91
+	 * The distance measurement unit for the route.
92
+	 * km or mi, the route4me api will convert all measurements into these units.
93
+	 * @var string
94
+	 */
95
+	public $distance_unit;
96
+
97
+	/**
98
+	 * The mode of travel that the directions should be optimized for.<br>
99
+	 *  Available values:
100
+	 * - Driving
101
+	 * - Walking
102
+	 * @var string
103
+	 */
104
+	public $travel_mode;
105
+
106
+	/**
107
+	 * Options which let the user choose which road obstacles to avoid.<br>
108
+	 * This has no impact on route sequencing.<br>
109
+	 * Available values:
110
+	 * - Highways
111
+	 * - Tolls
112
+	 * - minimizeHighways
113
+	 * - minimizeTolls
114
+	 * - highways,tolls
115
+	 * - "".
116
+	 * @var string
117
+	 */
118
+	public $avoid;
119
+
120
+	/**
121
+	 * The vehicle ID
122
+	 * @var string
123
+	 */
124
+	public $vehicle_id;
125
+
126
+	/**
127
+	 * The latitude of the device making this sdk request.
128
+	 * @var double
129
+	 */
130
+	public $dev_lat;
131
+
132
+	/**
133
+	 * The longitude of the device making this sdk request.
134
+	 * @var double
135
+	 */
136
+	public $dev_lng;
137
+
138
+	/**
139
+	 * When using a multiple driver algorithm, this is the maximum permissible duration of a generated route.<br>
140
+	 * The optimization system will automatically create more routes when the route_max_duration is exceeded for a route.<br>
141
+	 * However it will create an 'unrouted' list of addresses if the maximum number of drivers is exceeded.
142
+	 * @var long
143
+	 */
144
+	public $route_max_duration;
145
+
146
+	/**
147
+	 * The parameter specifies fine-tuning of an optimization process by route duration.
148
+	 * @var double
149
+	 */
150
+	public $target_duration;
151
+
152
+	/**
153
+	 * The parameter specifies fine-tuning of an optimization process by route distance.
154
+	 * @var double
155
+	 */
156
+	public $target_distance;
157
+
158
+	/**
159
+	 * The parameter specifies fine-tuning of an optimization process by waiting time.
160
+	 * @var double
161
+	 */
162
+	public $target_wait_by_tail_size;
163
+
164
+	/**
165
+	 * The email address to notify upon completion of an optimization request.
166
+	 * @var string
167
+	 */
168
+	public $route_email;
169
+
170
+	/**
171
+	 * @deprecated All routes are stored by default at this time
172
+	 * @var
173
+	 */
174
+	public $store_route = true;
175
+
176
+	/**
177
+	 * Metric system
178
+	 * @see Enum\Metric
179
+	 * @var integer
180
+	 */
181
+	public $metric;
182
+
183
+	/**
184
+	 * The algorithm type to use when optimizing the route.
185
+	 * @see Enum\AlgorithmType
186
+	 * @var integer
187
+	 */
188
+	public $algorithm_type;
189
+
190
+	/**
191
+	 * The route owner's member ID.<br>
192
+	 * In order for users in your organization to have routes assigned to them,
193
+	 * you must provide their member ID within the Route4Me system.<br>
194
+	 * A list of member IDs can be retrieved with view_users API method.
195
+	 * @var integer
196
+	 */
197
+	public $member_id;
198
+
199
+	/**
200
+	 * Specify the ip address of the remote user making this optimization request.
201
+	 * @var long
202
+	 */
203
+	public $ip;
204
+
205
+	/**
206
+	 * The method to use when compute the distance between the points in a route.<br>
207
+	 * Available values: from 1 to 12.
208
+	 * @var integer
209
+	 */
210
+	public $dm;
211
+
212
+	/**
213
+	 * Directions method.
214
+	 * @var integer
215
+	 */
216
+	public $dirm;
217
+
218
+	/**
219
+	 * Legacy feature which permits a user to request an example number of optimized routes.
220
+	 * @var integer
221
+	 */
222
+	public $parts;
223
+
224
+	/**
225
+	 * 32 Character MD5 String ID of the device that was used to plan this route.
226
+	 * @deprecated Always null
227
+	 * @var string
228
+	 */
229
+	public $device_id;
230
+
231
+	/**
232
+	 * The type of device making this request.
233
+	 * @see Enum\DeviceType
234
+	 * @var string
235
+	 */
236
+	public $device_type;
237
+
238
+	/**
239
+	 * If true, the vehicle has a trailer.<br>
240
+	 * For routes that have trucking directions enabled, directions generated<br>
241
+	 * will ensure compliance so that road directions generated do not take the vehicle
242
+	 * where trailers are prohibited.
243
+	 * @var Boolean
244
+	 */
245
+	public $has_trailer;
246
+
247
+	/**
248
+	 * The vehicle's trailer weight.<br>
249
+	 * For routes that have trucking directions enabled, directions generated<br>
250
+	 * will ensure compliance so that road directions generated do not take the vehicle<br>
251
+	 * on roads where the weight of the vehicle in tons exceeds this value.
252
+	 * @var double
253
+	 */
254
+	public $trailer_weight_t;
255
+
256
+	/**
257
+	 * If travel_mode is Trucking, specifies the truck weight.
258
+	 * @var double
259
+	 */
260
+	public $limited_weight_t;
261
+
262
+	/**
263
+	 * The vehicle's weight per axle (tons)
264
+	 * @var double
265
+	 */
266
+	public $weight_per_axle_t;
267
+
268
+	/**
269
+	 * Comma-delimited list of the truck hazardous goods.
270
+	 * @var string
271
+	 */
272
+	public $truck_hazardous_goods;
273
+
274
+	/**
275
+	 * Truck axles number.
276
+	 * @var integer
277
+	 */
278
+	public $truck_axles;
279
+
280
+	/**
281
+	 * Truck toll road usage. enum: ["YES", "NO"]
282
+	 * @var string
283
+	 */
284
+	public $truck_toll_road_usage;
285
+
286
+	/**
287
+	 * Truck avoid ferries. enum: ["YES", "NO"]
288
+	 * @var string
289
+	 */
290
+	public $truck_avoid_ferries;
291
+
292
+	/**
293
+	 * Truck highway only. enum: ["YES", "NO"]
294
+	 * @var string
295
+	 */
296
+	public $truck_hwy_only;
297
+
298
+	/**
299
+	 * Truck of the type Long Combination Vehicle. enum: ["YES", "NO"]
300
+	 * @var string
301
+	 */
302
+	public $truck_lcv;
303
+
304
+	/**
305
+	 * Avoid international borders. enum: ["YES", "NO"]
306
+	 * @var string
307
+	 */
308
+	public $truck_borders;
309
+
310
+	/**
311
+	 * Truck side street adherence.<br>
312
+	 *  enum: ["OFF", "MINIMAL","MODERATE","AVERAGE","STRICT","ADHERE","STRONGLYHERE"]
313
+	 * @var string
314
+	 */
315
+	public $truck_side_street_adherence;
316
+
317
+	/**
318
+	 * Truck configuration.
319
+	 * enum: ["NONE","PASSENGER","28_DOUBLETRAILER","48_STRAIGHT_TRUCK",
320
+	 * "48_SEMI_TRAILER","53_SEMI_TRAILER","FULLSIZEVAN","26_STRAIGHT_TRUCK"]
321
+	 * @var string
322
+	 */
323
+	public $truck_config;
324
+
325
+	/**
326
+	 * Truck dimension unit. enum: ["mi","km"]
327
+	 * @var string
328
+	 */
329
+	public $truck_dim_unit;
330
+
331
+	/**
332
+	 * Truck type.
333
+	 *  enum: ["suv","pickup_truck","van","18wheeler","cabin","waste_disposal",
334
+	 * "tree_cutting","bigrig","cement_mixer","livestock_carrier","dairy", "tractor_trailer"]
335
+	 * @var string
336
+	 */
337
+	public $truck_type;
338
+
339
+	/**
340
+	 * If travel_mode = 'Trucking', specifies the truck weight (required)
341
+	 * @var double
342
+	 */
343
+	public $truck_weight;
344
+
345
+	/**
346
+	 * Maximum cargo weight a vehicle can cary.
347
+	 * @var double
348
+	 */
349
+	public $vehicle_max_cargo_weight;
350
+
351
+	/**
352
+	 * Maximum cargo volume a vehicle can cary.
353
+	 * @var double
354
+	 */
355
+	public $vehicle_max_cargo_volume;
356
+
357
+	/**
358
+	 * Maximum allowed revenue from a subtour.
359
+	 * @var integer
360
+	 */
361
+	public $subtour_max_revenue;
362
+
363
+	/**
364
+	 * An array of the Avoidance zones IDs.
365
+	 * @var string[]
366
+	 */
367
+	public $avoidance_zones = [];
368
+
369
+	/**
370
+	 * The vehicle ID, to be assigned to the route.
371
+	 * @deprecated All new routes should be assigned to a member_id
372
+	 * @var string
373
+	 */
374
+	public $driver_id;
375
+
376
+	/**
377
+	 * Minimum number of optimized routes.
378
+	 * @var integer
379
+	 */
380
+	public $parts_min;
381
+
382
+	/**
383
+	 * If true, the vehicle will first drive then wait between stops.
384
+	 * @var Boolean
385
+	 */
386
+	public $first_drive_then_wait_between_stops;
387
+
388
+	/**
389
+	 * The truck height.<br>
390
+	 * For routes that have trucking directions enabled, directions generated<br>
391
+	 * will ensure compliance of this maximum height of truck when generating
392
+	 * road network driving directions.
393
+	 * @var double
394
+	 */
395
+	public $truck_height;
396
+
397
+	/**
398
+	 * The truck width.<br>
399
+	 * For routes that have trucking directions enabled, directions generated
400
+	 * will ensure compliance of this width of the truck when generating road network
401
+	 * driving directions.
402
+	 * @var double
403
+	 */
404
+	public $truck_width;
405
+
406
+	/**
407
+	 * The truck length.<br>
408
+	 * For routes that have trucking directions enabled, directions generated
409
+	 * will ensure compliance of this length of the truck when generating
410
+	 * road network driving directions.
411
+	 * @var double
412
+	 */
413
+	public $truck_length;
414
+
415
+	/**
416
+	 * The optimization quality.<br>
417
+	 * Available values:
418
+	 * - 1 - Generate Optimized Routes As Quickly as Possible;
419
+	 * - 2 - Generate Routes That Look Better On A Map;
420
+	 * - 3 - Generate The Shortest And Quickest Possible Routes.
421
+	 * @var integer
422
+	 */
423
+	public $optimization_quality;
424
+
425
+	/**
426
+	 * The maximum number of stops permitted per created subroute.
427
+	 * @var integer
428
+	 */
429
+	public $max_tour_size;
430
+
431
+	/**
432
+	 * The minimum number of stops permitted per created subroute.
433
+	 * @var integer
434
+	 */
435
+	public $min_tour_size;
436
+
437
+	/**
438
+	 * If equal to 1, uturn is allowed for the vehicle.
439
+	 * @var integer
440
+	 */
441
+	public $uturn;
442
+
443
+	/**
444
+	 * If equal to 1, leftturn is allowed for the vehicle.
445
+	 * @var integer
446
+	 */
447
+	public $leftturn;
448
+
449
+	/**
450
+	 * If equal to 1, rightturn is allowed for the vehicle.
451
+	 * @var integer
452
+	 */
453
+	public $rightturn;
454
+
455
+	/**
456
+	 * Route travel time slowdown (e.g. 25 (means 25% slowdown)).
457
+	 * @note the parameter is read-only and it can be set
458
+	 * with the parameter Slowdowns.TravelTime.
459
+	 * @var integer
460
+	 */
461
+	public $route_time_multiplier;
462
+
463
+	/**
464
+	 * Route service time slowdown (e.g. 10 (means 10% slowdown)).
465
+	 * @note the parameter is read-only and it can be set
466
+	 * with the parameter Slowdowns.TravelTime.
467
+	 * @var integer
468
+	 */
469
+	public $route_service_time_multiplier;
470
+
471
+	/**
472
+	 * Optimization engine (e.g. '1','2' etc)
473
+	 * @var string
474
+	 */
475
+	public $optimization_engine;
476
+
477
+	/**
478
+	 * Override addresses
479
+	 * @var OverrideAddresses
480
+	 */
481
+	public $override_addresses;
482
+
483
+	/**
484
+	 * Address bundling rules
485
+	 * @var V5\Addresses\AddressBundling
486
+	 */
487
+	public $bundling;
488
+
489
+	/**
490
+	 * Advanced route constraints
491
+	 * @var RouteAdvancedConstraints
492
+	 */
493
+	public $advanced_constraints = [];
494
+
495
+	/**
496
+	 * If true, the time windows ignored.
497
+	 * @var Boolean
498
+	 */
499
+	public $ignore_tw;
500
+
501
+	/**
502
+	 * If true, the start time is dynamic.
503
+	 * @var Boolean
504
+	 */
505
+	public $is_dynamic_start_time;
506
+
507
+	/**
508
+	 * @deprecated The parameter 'route_type' isn't included in route parameters.
509
+	 * @var string
510
+	 */
511
+	public $route_type;
512
+
513
+	/**
514
+	 * Slowdown of the optimization parameters.
515
+	 * @note This is only query parameter.
516
+	 * @note This parameter is used in the optimization creation/generation process.
517
+	 * @var SlowdownParams
518
+	 */
519
+	public $slowdowns;
520
+
521
+	public function setAddressBundle($addressBundle)
522
+	{
523
+		$this->bundling = $addressBundle;
524
+	}
525
+
526
+	public function getAddressBundle()
527
+	{
528
+		return $this->bundling;
529
+	}
530 530
 }
Please login to merge, or discard this patch.
src/Route4Me/AvoidanceZone.php 1 patch
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -7,107 +7,107 @@
 block discarded – undo
7 7
 
8 8
 class AvoidanceZone extends Common
9 9
 {
10
-    public $territory_id; // Avoidance zone id
11
-    public $territory_name;
12
-    public $territory_color;
13
-    public $orders;
14
-    public $member_id;
15
-    public $territory; // Territory parameters
16
-
17
-    public function __construct()
18
-    {
19
-        Route4Me::setBaseUrl(Endpoint::BASE_URL);
20
-    }
21
-
22
-    public static function fromArray(array $params)
23
-    {
24
-        if (!isset($params['territory_name'])) {
25
-            throw new BadParam('Territory name must be provided');
26
-        }
27
-
28
-        if (!isset($params['territory_color'])) {
29
-            throw new BadParam('Territory color must be provided');
30
-        }
31
-
32
-        if (!isset($params['territory'])) {
33
-            throw new BadParam('Territory must be provided');
34
-        }
35
-        return parent::fromArray($params);
36
-    }
37
-
38
-    public static function getAvoidanceZone($territory_id)
39
-    {
40
-        $avoidanceZone = Route4Me::makeRequst([
41
-            'url'       => Endpoint::AVOIDANCE_ZONE,
42
-            'method'    => 'GET',
43
-            'query'     => [
44
-                'territory_id' => $territory_id,
45
-            ],
46
-        ]);
47
-
48
-        return $avoidanceZone;
49
-    }
50
-
51
-    public static function getAvoidanceZones($params)
52
-    {
53
-        $avoidanceZones = Route4Me::makeRequst([
54
-            'url'       => Endpoint::AVOIDANCE_ZONE,
55
-            'method'    => 'GET',
56
-            'query'     => [
57
-                'offset' => isset($params->offset) ? $params->offset : null,
58
-                'limit'  => isset($params->limit) ? $params->limit : null,
59
-            ],
60
-        ]);
61
-
62
-        return $avoidanceZones;
63
-    }
64
-
65
-    public static function addAvoidanceZone($params)
66
-    {
67
-        $terParams = [];
68
-
69
-        if (isset($params->territory['type'])) {
70
-            $terParams['type'] = $params->territory['type'];
71
-        }
72
-
73
-        if (isset($params->territory['data'])) {
74
-            $terParams['data'] = $params->territory['data'];
75
-        }
76
-
77
-        $abContacts = Route4Me::makeRequst([
78
-            'url'       => Endpoint::AVOIDANCE_ZONE,
79
-            'method'    => 'POST',
80
-            'body'      => [
81
-                'territory_name'    => isset($params->territory_name) ? $params->territory_name : null,
82
-                'territory_color'   => isset($params->territory_color) ? $params->territory_color : null,
83
-                'territory'         => $terParams,
84
-            ],
85
-        ]);
86
-
87
-        return $abContacts;
88
-    }
89
-
90
-    public function deleteAvoidanceZone($territory_id)
91
-    {
92
-        $result = Route4Me::makeRequst([
93
-            'url'       => Endpoint::AVOIDANCE_ZONE,
94
-            'method'    => 'DELETEARRAY',
95
-            'query'     => [
96
-                'territory_id' => $territory_id,
97
-            ],
98
-        ]);
99
-
100
-        return $result;
101
-    }
102
-
103
-    public function updateAvoidanceZone($params)
104
-    {
105
-        $avoidanceZone = Route4Me::makeRequst([
106
-            'url'       => Endpoint::AVOIDANCE_ZONE,
107
-            'method'    => 'PUT',
108
-            'body'      => $params,
109
-        ]);
110
-
111
-        return $avoidanceZone;
112
-    }
10
+	public $territory_id; // Avoidance zone id
11
+	public $territory_name;
12
+	public $territory_color;
13
+	public $orders;
14
+	public $member_id;
15
+	public $territory; // Territory parameters
16
+
17
+	public function __construct()
18
+	{
19
+		Route4Me::setBaseUrl(Endpoint::BASE_URL);
20
+	}
21
+
22
+	public static function fromArray(array $params)
23
+	{
24
+		if (!isset($params['territory_name'])) {
25
+			throw new BadParam('Territory name must be provided');
26
+		}
27
+
28
+		if (!isset($params['territory_color'])) {
29
+			throw new BadParam('Territory color must be provided');
30
+		}
31
+
32
+		if (!isset($params['territory'])) {
33
+			throw new BadParam('Territory must be provided');
34
+		}
35
+		return parent::fromArray($params);
36
+	}
37
+
38
+	public static function getAvoidanceZone($territory_id)
39
+	{
40
+		$avoidanceZone = Route4Me::makeRequst([
41
+			'url'       => Endpoint::AVOIDANCE_ZONE,
42
+			'method'    => 'GET',
43
+			'query'     => [
44
+				'territory_id' => $territory_id,
45
+			],
46
+		]);
47
+
48
+		return $avoidanceZone;
49
+	}
50
+
51
+	public static function getAvoidanceZones($params)
52
+	{
53
+		$avoidanceZones = Route4Me::makeRequst([
54
+			'url'       => Endpoint::AVOIDANCE_ZONE,
55
+			'method'    => 'GET',
56
+			'query'     => [
57
+				'offset' => isset($params->offset) ? $params->offset : null,
58
+				'limit'  => isset($params->limit) ? $params->limit : null,
59
+			],
60
+		]);
61
+
62
+		return $avoidanceZones;
63
+	}
64
+
65
+	public static function addAvoidanceZone($params)
66
+	{
67
+		$terParams = [];
68
+
69
+		if (isset($params->territory['type'])) {
70
+			$terParams['type'] = $params->territory['type'];
71
+		}
72
+
73
+		if (isset($params->territory['data'])) {
74
+			$terParams['data'] = $params->territory['data'];
75
+		}
76
+
77
+		$abContacts = Route4Me::makeRequst([
78
+			'url'       => Endpoint::AVOIDANCE_ZONE,
79
+			'method'    => 'POST',
80
+			'body'      => [
81
+				'territory_name'    => isset($params->territory_name) ? $params->territory_name : null,
82
+				'territory_color'   => isset($params->territory_color) ? $params->territory_color : null,
83
+				'territory'         => $terParams,
84
+			],
85
+		]);
86
+
87
+		return $abContacts;
88
+	}
89
+
90
+	public function deleteAvoidanceZone($territory_id)
91
+	{
92
+		$result = Route4Me::makeRequst([
93
+			'url'       => Endpoint::AVOIDANCE_ZONE,
94
+			'method'    => 'DELETEARRAY',
95
+			'query'     => [
96
+				'territory_id' => $territory_id,
97
+			],
98
+		]);
99
+
100
+		return $result;
101
+	}
102
+
103
+	public function updateAvoidanceZone($params)
104
+	{
105
+		$avoidanceZone = Route4Me::makeRequst([
106
+			'url'       => Endpoint::AVOIDANCE_ZONE,
107
+			'method'    => 'PUT',
108
+			'body'      => $params,
109
+		]);
110
+
111
+		return $avoidanceZone;
112
+	}
113 113
 }
Please login to merge, or discard this patch.
src/Route4Me/TelematicsVendor.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -6,62 +6,62 @@
 block discarded – undo
6 6
 
7 7
 class TelematicsVendor extends Common
8 8
 {
9
-    public $id; // Telematics Vendor id
10
-    public $name; // Vendor name
11
-    public $slug; // Vendor slug
12
-    public $description; // Vendor description
13
-    public $logo_url; // Vendor's logo URL
14
-    public $website_url; // Vendor's website URL
15
-    public $api_docs_url; // API documentation URL
16
-    public $is_integrated; // If 1, the vendor is integrated in Route4Me
17
-    public $size; // Vendor size
18
-    public $page; // starting page
19
-    public $per_page; // Vendors per page in a response
20
-    public $countries = []; // Country Alpha 2 code
21
-    public $features = []; // Vendor's feature
22
-    public $search; // Searched text
23
-    public $vendors; // Comma-delimited list of the vendors IDs.
24
-
25
-    public static function GetTelematicsVendors($params)
26
-    {
27
-        Route4Me::setBaseUrl(Endpoint::TELEMATICS_VENDORS);
28
-
29
-        $allQueryFields = ['vendor_id', 'is_integrated', 'page', 'per_page', 'country', 'feature', 'search', 'vendors'];
30
-
31
-        $vendors = Route4Me::makeRequst([
32
-            'url'       => '',
33
-            'method'    => 'GET',
34
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
35
-        ]);
36
-
37
-        return $vendors;
38
-    }
39
-
40
-    public static function GetRandomVendorID($offset, $limit)
41
-    {
42
-        $allVendors = self::GetTelematicsVendors(null);
43
-        $vendorsNumber = sizeof($allVendors['vendors']);
44
-
45
-        if ($vendorsNumber < $limit) {
46
-            if ($vendorsNumber > $offset) {
47
-                $limit = $vendorsNumber;
48
-            } else {
49
-                if ($vendorsNumber == $offset) {
50
-                    return $allVendors['vendors'][$offset]->{'vendor_id'};
51
-                } else {
52
-                    echo 'The vendors numbers are less than offset';
53
-
54
-                    return null;
55
-                }
56
-            }
57
-        }
58
-
59
-        $randNumber = rand($offset, $limit);
60
-
61
-        return $allVendors['vendors'][$randNumber]['id'];
62
-    }
63
-
64
-    /*
9
+	public $id; // Telematics Vendor id
10
+	public $name; // Vendor name
11
+	public $slug; // Vendor slug
12
+	public $description; // Vendor description
13
+	public $logo_url; // Vendor's logo URL
14
+	public $website_url; // Vendor's website URL
15
+	public $api_docs_url; // API documentation URL
16
+	public $is_integrated; // If 1, the vendor is integrated in Route4Me
17
+	public $size; // Vendor size
18
+	public $page; // starting page
19
+	public $per_page; // Vendors per page in a response
20
+	public $countries = []; // Country Alpha 2 code
21
+	public $features = []; // Vendor's feature
22
+	public $search; // Searched text
23
+	public $vendors; // Comma-delimited list of the vendors IDs.
24
+
25
+	public static function GetTelematicsVendors($params)
26
+	{
27
+		Route4Me::setBaseUrl(Endpoint::TELEMATICS_VENDORS);
28
+
29
+		$allQueryFields = ['vendor_id', 'is_integrated', 'page', 'per_page', 'country', 'feature', 'search', 'vendors'];
30
+
31
+		$vendors = Route4Me::makeRequst([
32
+			'url'       => '',
33
+			'method'    => 'GET',
34
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
35
+		]);
36
+
37
+		return $vendors;
38
+	}
39
+
40
+	public static function GetRandomVendorID($offset, $limit)
41
+	{
42
+		$allVendors = self::GetTelematicsVendors(null);
43
+		$vendorsNumber = sizeof($allVendors['vendors']);
44
+
45
+		if ($vendorsNumber < $limit) {
46
+			if ($vendorsNumber > $offset) {
47
+				$limit = $vendorsNumber;
48
+			} else {
49
+				if ($vendorsNumber == $offset) {
50
+					return $allVendors['vendors'][$offset]->{'vendor_id'};
51
+				} else {
52
+					echo 'The vendors numbers are less than offset';
53
+
54
+					return null;
55
+				}
56
+			}
57
+		}
58
+
59
+		$randNumber = rand($offset, $limit);
60
+
61
+		return $allVendors['vendors'][$randNumber]['id'];
62
+	}
63
+
64
+	/*
65 65
     public static function GetTelematicsVendor($params) {
66 66
         Route4Me::setBaseUrl(Endpoint::TELEMATICS_VENDORS);
67 67
 
Please login to merge, or discard this patch.
UnitTestFiles/Test/AddressBookGroupUnitTests.php 2 patches
Indentation   +272 added lines, -272 removed lines patch added patch discarded remove patch
@@ -9,276 +9,276 @@
 block discarded – undo
9 9
 
10 10
 class AddressBookGroupUnitTests extends \PHPUnit\Framework\TestCase
11 11
 {
12
-    public static $createdGroups = [];
13
-
14
-    public static function setUpBeforeClass()
15
-    {
16
-        Route4Me::setApiKey(Constants::API_KEY);
17
-
18
-        $abg = new AddressBookGroup();
19
-
20
-        $createParameters= [
21
-            'group_name'    => 'All Group',
22
-            'group_color'   => '92e1c0',
23
-            'filter'        => [
24
-                'condition' => 'AND',
25
-                'rules'     => [[
26
-                    'id'       => 'address_1',
27
-                    'field'    => 'address_1',
28
-                    'operator' => 'not_equal',
29
-                    'value'    => 'qwerty123456'
30
-                ]]
31
-            ]
32
-        ];
33
-
34
-        $createdAddressBookGroup = AddressBookGroup::fromArray(
35
-            $abg->createAddressBookGroup($createParameters)
36
-        );
37
-
38
-        self::$createdGroups[] = $createdAddressBookGroup;
39
-
40
-        $createParameters= [
41
-            'group_name'    => 'All Group',
42
-            'group_color'   => '92e1c0',
43
-            'filter'        => [
44
-                'condition' => 'AND',
45
-                'rules'     => [[
46
-                    'id'       => 'address_1',
47
-                    'field'    => 'address_1',
48
-                    'operator' => 'not_equal',
49
-                    'value'    => 'qwerty123456'
50
-                ]]
51
-            ]
52
-        ];
53
-
54
-        $createdAddressBookGroup = AddressBookGroup::fromArray(
55
-            $abg->createAddressBookGroup($createParameters)
56
-        );
57
-
58
-        self::$createdGroups[] = $createdAddressBookGroup;
59
-    }
60
-
61
-    public function testFromArray()
62
-    {
63
-        $addressBookGroup = AddressBookGroup::fromArray([
64
-            'group_id'      => '137F9F99544DB34C160B2B9AF8FC6A12',
65
-            'group_name'    => 'Ocassion example',
66
-            'group_color'   => '92e1c0',
67
-            'group_icon'    => 'emoji-pushpin',
68
-            'member_id'     => 444333,
69
-            'filter' => [
70
-              'condition'   => 'AND',
71
-              'rules'       => [
72
-                [
73
-                  'id'          => 'custom_data.occasion',
74
-                  'field'       => 'custom_data.occasion',
75
-                  'operator'    => 'equal',
76
-                  'value'       => '100'
77
-                ]]
78
-            ]
79
-        ]);
80
-
81
-        $this->assertEquals('137F9F99544DB34C160B2B9AF8FC6A12', $addressBookGroup->group_id);
82
-        $this->assertEquals('Ocassion example', $addressBookGroup->group_name);
83
-        $this->assertEquals('92e1c0', $addressBookGroup->group_color);
84
-        $this->assertEquals('emoji-pushpin', $addressBookGroup->group_icon);
85
-        $this->assertEquals(444333, $addressBookGroup->member_id);
86
-        $this->assertEquals([
87
-            'condition'   => 'AND',
88
-            'rules'       => [
89
-                [
90
-                    'id'          => 'custom_data.occasion',
91
-                    'field'       => 'custom_data.occasion',
92
-                    'operator'    => 'equal',
93
-                    'value'       => '100'
94
-                ]]
95
-        ], $addressBookGroup->filter);
96
-    }
97
-
98
-    public function testGetAddressBookGroup()
99
-    {
100
-        $groupId = self::$createdGroups[0]->group_id;
101
-
102
-        $abg = new AddressBookGroup();
103
-
104
-        $result = AddressBookGroup::fromArray(
105
-            $abg->getAddressBookGroup(['group_id' => $groupId])
106
-        );
107
-
108
-        $this->assertNotNull($result);
109
-        $this->assertContainsOnlyInstancesOf(AddressBookGroup::class, [$result]);
110
-    }
111
-
112
-    public function testUpdateAddressBookGroup()
113
-    {
114
-        $groupId = self::$createdGroups[0]->group_id;
115
-
116
-        $updateParameters= [
117
-            'group_id'      => $groupId,
118
-            'group_color'   => '7bd148'
119
-        ];
120
-
121
-        $result = AddressBookGroup::fromArray(
122
-            AddressBookGroup::updateAddressBookGroup($updateParameters)
123
-        );
124
-
125
-        $this->assertNotNull($result);
126
-        $this->assertContainsOnlyInstancesOf(AddressBookGroup::class, [$result]);
127
-        $this->assertEquals('7bd148', $result->group_color);
128
-    }
129
-
130
-    public function testRemoveAddressBookGroup()
131
-    {
132
-        $groupId = end(self::$createdGroups)->group_id;
133
-
134
-        $removeParameters= [
135
-            'group_id' => $groupId
136
-        ];
137
-
138
-        $result = AddressBookGroup::removeAddressBookGroup($removeParameters);
139
-
140
-        $this->assertNotNull($result);
141
-        $this->assertTrue(isset($result['status']));
142
-        $this->assertTrue($result['status']);
143
-
144
-        self::$createdGroups[] = array_pop(self::$createdGroups);
145
-    }
146
-
147
-    public function testCreateAddressBookGroup()
148
-    {
149
-        $createParameters= [
150
-            'group_name'    => 'All Group',
151
-            'group_color'   => '92e2cd',
152
-            'filter'        => [
153
-                'condition' => 'AND',
154
-                'rules'     => [[
155
-                    'id'       => 'address_1',
156
-                    'field'    => 'address_1',
157
-                    'operator' => 'not_equal',
158
-                    'value'    => 'qwerty654321'
159
-                ]]
160
-            ]
161
-        ];
162
-
163
-        $createdAddressBookGroup = AddressBookGroup::fromArray(
164
-            AddressBookGroup::createAddressBookGroup($createParameters)
165
-        );
166
-
167
-        $this->assertNotNull($createdAddressBookGroup);
168
-        $this->assertContainsOnlyInstancesOf(AddressBookGroup::class, [$createdAddressBookGroup]);
169
-        $this->assertEquals('92e2cd', $createdAddressBookGroup->group_color);
170
-
171
-        self::$createdGroups[] = $createdAddressBookGroup;
172
-    }
173
-
174
-    public function testSearchAddressBookGroups()
175
-    {
176
-        $searchParameters = [
177
-            'fields' => ['address_id', 'address_1', 'address_group'],
178
-            'limit' => 10,
179
-            'offset' => 0,
180
-            'filter' => [
181
-                'query' => "Louisville",
182
-                "display" => "all"
183
-            ]
184
-        ];
185
-
186
-        $addressBookGroups = SearchResponse::fromArray(
187
-            AddressBookGroup::searchAddressBookGroups($searchParameters)
188
-        );
189
-
190
-        $this->assertNotNull($addressBookGroups);
191
-        $this->assertTrue(sizeof($addressBookGroups->fields)==3);
192
-        $this->assertContains('address_id', $addressBookGroups->fields);
193
-        $this->assertContains('address_1', $addressBookGroups->fields);
194
-        $this->assertContains('address_group', $addressBookGroups->fields);
195
-
196
-        $this->assertNotNull($addressBookGroups->results);
197
-
198
-        if (sizeof($addressBookGroups->results)>0) {
199
-            $this->assertContains('Louisville', implode(", ", $addressBookGroups->results[0]));
200
-        }
201
-    }
202
-
203
-    public function testGetAddressBookContactsByGroup()
204
-    {
205
-        //$this->markTestSkipped('must be revisited.');
206
-
207
-        $groupId = self::$createdGroups[0]->group_id;
208
-
209
-        $searchParameters = [
210
-            'fields'    => ['address_id'],
211
-            'group_id'  => $groupId,
212
-        ];
213
-
214
-        $result = AddressBookGroup::getAddressBookContactsByGroup($searchParameters);
215
-
216
-        $this->assertNotNull($result);
217
-        $this->assertTrue(isset($result['total']));
218
-        $this->assertTrue(isset($result['results']));
219
-        $this->assertTrue(is_array($result['results']));
220
-    }
221
-
222
-    public function testGetAddressBookGroups()
223
-    {
224
-        $addressBookGroupParameters = [
225
-            'limit'  => 20,
226
-            'offset' => 0,
227
-        ];
228
-
229
-        $addressBookGroups = AddressBookGroup::getAddressBookGroups($addressBookGroupParameters);
230
-
231
-        $this->assertNotNull($addressBookGroups);
232
-
233
-        $firstGroup = AddressBookGroup::fromArray(
234
-            $addressBookGroups[0]
235
-        );
236
-
237
-        $this->assertTrue(sizeof($addressBookGroups)>0);
238
-        $this->assertContainsOnlyInstancesOf(AddressBookGroup::class, [$firstGroup]);
239
-    }
240
-
241
-    public function testgGetRandomAddressBookGroup()
242
-    {
243
-        $addressBookGroupParameters = [
244
-            'limit'  => 20,
245
-            'offset' => 0,
246
-        ];
247
-
248
-        $randomGroup = AddressBookGroup::fromArray(
249
-            AddressBookGroup::getRandomAddressBookGroup($addressBookGroupParameters)
250
-        );
251
-
252
-        $this->assertNotNull($randomGroup);
253
-        $this->assertContainsOnlyInstancesOf(AddressBookGroup::class, [$randomGroup]);
254
-    }
255
-
256
-    public function testGetAddressBookGroupIdByName()
257
-    {
258
-        $firstGroup = self::$createdGroups[0];
259
-
260
-        $groupIds = AddressBookGroup::getAddressBookGroupIdByName($firstGroup->group_name);
261
-
262
-        $this->assertNotNull($groupIds);
263
-        $this->assertTrue(in_array($firstGroup->group_id, $groupIds));
264
-    }
265
-
266
-    public static function tearDownAfterClass()
267
-    {
268
-        foreach (self::$createdGroups as $createdGroup) {
269
-            $groupId = $createdGroup->group_id;
270
-
271
-            $removeParameters= [
272
-                'group_id' => $groupId
273
-            ];
274
-
275
-            $result = AddressBookGroup::removeAddressBookGroup($removeParameters);
276
-
277
-            if ($result!=null && isset($result['status']) && isset($result['status'])) {
278
-                echo "The address book group ".$groupId." removed successfully <br>";
279
-            } else {
280
-                echo "Cannot remove the address book group ".$groupId."<br>";
281
-            }
282
-        }
283
-    }
12
+	public static $createdGroups = [];
13
+
14
+	public static function setUpBeforeClass()
15
+	{
16
+		Route4Me::setApiKey(Constants::API_KEY);
17
+
18
+		$abg = new AddressBookGroup();
19
+
20
+		$createParameters= [
21
+			'group_name'    => 'All Group',
22
+			'group_color'   => '92e1c0',
23
+			'filter'        => [
24
+				'condition' => 'AND',
25
+				'rules'     => [[
26
+					'id'       => 'address_1',
27
+					'field'    => 'address_1',
28
+					'operator' => 'not_equal',
29
+					'value'    => 'qwerty123456'
30
+				]]
31
+			]
32
+		];
33
+
34
+		$createdAddressBookGroup = AddressBookGroup::fromArray(
35
+			$abg->createAddressBookGroup($createParameters)
36
+		);
37
+
38
+		self::$createdGroups[] = $createdAddressBookGroup;
39
+
40
+		$createParameters= [
41
+			'group_name'    => 'All Group',
42
+			'group_color'   => '92e1c0',
43
+			'filter'        => [
44
+				'condition' => 'AND',
45
+				'rules'     => [[
46
+					'id'       => 'address_1',
47
+					'field'    => 'address_1',
48
+					'operator' => 'not_equal',
49
+					'value'    => 'qwerty123456'
50
+				]]
51
+			]
52
+		];
53
+
54
+		$createdAddressBookGroup = AddressBookGroup::fromArray(
55
+			$abg->createAddressBookGroup($createParameters)
56
+		);
57
+
58
+		self::$createdGroups[] = $createdAddressBookGroup;
59
+	}
60
+
61
+	public function testFromArray()
62
+	{
63
+		$addressBookGroup = AddressBookGroup::fromArray([
64
+			'group_id'      => '137F9F99544DB34C160B2B9AF8FC6A12',
65
+			'group_name'    => 'Ocassion example',
66
+			'group_color'   => '92e1c0',
67
+			'group_icon'    => 'emoji-pushpin',
68
+			'member_id'     => 444333,
69
+			'filter' => [
70
+			  'condition'   => 'AND',
71
+			  'rules'       => [
72
+				[
73
+				  'id'          => 'custom_data.occasion',
74
+				  'field'       => 'custom_data.occasion',
75
+				  'operator'    => 'equal',
76
+				  'value'       => '100'
77
+				]]
78
+			]
79
+		]);
80
+
81
+		$this->assertEquals('137F9F99544DB34C160B2B9AF8FC6A12', $addressBookGroup->group_id);
82
+		$this->assertEquals('Ocassion example', $addressBookGroup->group_name);
83
+		$this->assertEquals('92e1c0', $addressBookGroup->group_color);
84
+		$this->assertEquals('emoji-pushpin', $addressBookGroup->group_icon);
85
+		$this->assertEquals(444333, $addressBookGroup->member_id);
86
+		$this->assertEquals([
87
+			'condition'   => 'AND',
88
+			'rules'       => [
89
+				[
90
+					'id'          => 'custom_data.occasion',
91
+					'field'       => 'custom_data.occasion',
92
+					'operator'    => 'equal',
93
+					'value'       => '100'
94
+				]]
95
+		], $addressBookGroup->filter);
96
+	}
97
+
98
+	public function testGetAddressBookGroup()
99
+	{
100
+		$groupId = self::$createdGroups[0]->group_id;
101
+
102
+		$abg = new AddressBookGroup();
103
+
104
+		$result = AddressBookGroup::fromArray(
105
+			$abg->getAddressBookGroup(['group_id' => $groupId])
106
+		);
107
+
108
+		$this->assertNotNull($result);
109
+		$this->assertContainsOnlyInstancesOf(AddressBookGroup::class, [$result]);
110
+	}
111
+
112
+	public function testUpdateAddressBookGroup()
113
+	{
114
+		$groupId = self::$createdGroups[0]->group_id;
115
+
116
+		$updateParameters= [
117
+			'group_id'      => $groupId,
118
+			'group_color'   => '7bd148'
119
+		];
120
+
121
+		$result = AddressBookGroup::fromArray(
122
+			AddressBookGroup::updateAddressBookGroup($updateParameters)
123
+		);
124
+
125
+		$this->assertNotNull($result);
126
+		$this->assertContainsOnlyInstancesOf(AddressBookGroup::class, [$result]);
127
+		$this->assertEquals('7bd148', $result->group_color);
128
+	}
129
+
130
+	public function testRemoveAddressBookGroup()
131
+	{
132
+		$groupId = end(self::$createdGroups)->group_id;
133
+
134
+		$removeParameters= [
135
+			'group_id' => $groupId
136
+		];
137
+
138
+		$result = AddressBookGroup::removeAddressBookGroup($removeParameters);
139
+
140
+		$this->assertNotNull($result);
141
+		$this->assertTrue(isset($result['status']));
142
+		$this->assertTrue($result['status']);
143
+
144
+		self::$createdGroups[] = array_pop(self::$createdGroups);
145
+	}
146
+
147
+	public function testCreateAddressBookGroup()
148
+	{
149
+		$createParameters= [
150
+			'group_name'    => 'All Group',
151
+			'group_color'   => '92e2cd',
152
+			'filter'        => [
153
+				'condition' => 'AND',
154
+				'rules'     => [[
155
+					'id'       => 'address_1',
156
+					'field'    => 'address_1',
157
+					'operator' => 'not_equal',
158
+					'value'    => 'qwerty654321'
159
+				]]
160
+			]
161
+		];
162
+
163
+		$createdAddressBookGroup = AddressBookGroup::fromArray(
164
+			AddressBookGroup::createAddressBookGroup($createParameters)
165
+		);
166
+
167
+		$this->assertNotNull($createdAddressBookGroup);
168
+		$this->assertContainsOnlyInstancesOf(AddressBookGroup::class, [$createdAddressBookGroup]);
169
+		$this->assertEquals('92e2cd', $createdAddressBookGroup->group_color);
170
+
171
+		self::$createdGroups[] = $createdAddressBookGroup;
172
+	}
173
+
174
+	public function testSearchAddressBookGroups()
175
+	{
176
+		$searchParameters = [
177
+			'fields' => ['address_id', 'address_1', 'address_group'],
178
+			'limit' => 10,
179
+			'offset' => 0,
180
+			'filter' => [
181
+				'query' => "Louisville",
182
+				"display" => "all"
183
+			]
184
+		];
185
+
186
+		$addressBookGroups = SearchResponse::fromArray(
187
+			AddressBookGroup::searchAddressBookGroups($searchParameters)
188
+		);
189
+
190
+		$this->assertNotNull($addressBookGroups);
191
+		$this->assertTrue(sizeof($addressBookGroups->fields)==3);
192
+		$this->assertContains('address_id', $addressBookGroups->fields);
193
+		$this->assertContains('address_1', $addressBookGroups->fields);
194
+		$this->assertContains('address_group', $addressBookGroups->fields);
195
+
196
+		$this->assertNotNull($addressBookGroups->results);
197
+
198
+		if (sizeof($addressBookGroups->results)>0) {
199
+			$this->assertContains('Louisville', implode(", ", $addressBookGroups->results[0]));
200
+		}
201
+	}
202
+
203
+	public function testGetAddressBookContactsByGroup()
204
+	{
205
+		//$this->markTestSkipped('must be revisited.');
206
+
207
+		$groupId = self::$createdGroups[0]->group_id;
208
+
209
+		$searchParameters = [
210
+			'fields'    => ['address_id'],
211
+			'group_id'  => $groupId,
212
+		];
213
+
214
+		$result = AddressBookGroup::getAddressBookContactsByGroup($searchParameters);
215
+
216
+		$this->assertNotNull($result);
217
+		$this->assertTrue(isset($result['total']));
218
+		$this->assertTrue(isset($result['results']));
219
+		$this->assertTrue(is_array($result['results']));
220
+	}
221
+
222
+	public function testGetAddressBookGroups()
223
+	{
224
+		$addressBookGroupParameters = [
225
+			'limit'  => 20,
226
+			'offset' => 0,
227
+		];
228
+
229
+		$addressBookGroups = AddressBookGroup::getAddressBookGroups($addressBookGroupParameters);
230
+
231
+		$this->assertNotNull($addressBookGroups);
232
+
233
+		$firstGroup = AddressBookGroup::fromArray(
234
+			$addressBookGroups[0]
235
+		);
236
+
237
+		$this->assertTrue(sizeof($addressBookGroups)>0);
238
+		$this->assertContainsOnlyInstancesOf(AddressBookGroup::class, [$firstGroup]);
239
+	}
240
+
241
+	public function testgGetRandomAddressBookGroup()
242
+	{
243
+		$addressBookGroupParameters = [
244
+			'limit'  => 20,
245
+			'offset' => 0,
246
+		];
247
+
248
+		$randomGroup = AddressBookGroup::fromArray(
249
+			AddressBookGroup::getRandomAddressBookGroup($addressBookGroupParameters)
250
+		);
251
+
252
+		$this->assertNotNull($randomGroup);
253
+		$this->assertContainsOnlyInstancesOf(AddressBookGroup::class, [$randomGroup]);
254
+	}
255
+
256
+	public function testGetAddressBookGroupIdByName()
257
+	{
258
+		$firstGroup = self::$createdGroups[0];
259
+
260
+		$groupIds = AddressBookGroup::getAddressBookGroupIdByName($firstGroup->group_name);
261
+
262
+		$this->assertNotNull($groupIds);
263
+		$this->assertTrue(in_array($firstGroup->group_id, $groupIds));
264
+	}
265
+
266
+	public static function tearDownAfterClass()
267
+	{
268
+		foreach (self::$createdGroups as $createdGroup) {
269
+			$groupId = $createdGroup->group_id;
270
+
271
+			$removeParameters= [
272
+				'group_id' => $groupId
273
+			];
274
+
275
+			$result = AddressBookGroup::removeAddressBookGroup($removeParameters);
276
+
277
+			if ($result!=null && isset($result['status']) && isset($result['status'])) {
278
+				echo "The address book group ".$groupId." removed successfully <br>";
279
+			} else {
280
+				echo "Cannot remove the address book group ".$groupId."<br>";
281
+			}
282
+		}
283
+	}
284 284
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
         $abg = new AddressBookGroup();
19 19
 
20
-        $createParameters= [
20
+        $createParameters = [
21 21
             'group_name'    => 'All Group',
22 22
             'group_color'   => '92e1c0',
23 23
             'filter'        => [
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
         self::$createdGroups[] = $createdAddressBookGroup;
39 39
 
40
-        $createParameters= [
40
+        $createParameters = [
41 41
             'group_name'    => 'All Group',
42 42
             'group_color'   => '92e1c0',
43 43
             'filter'        => [
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $groupId = self::$createdGroups[0]->group_id;
115 115
 
116
-        $updateParameters= [
116
+        $updateParameters = [
117 117
             'group_id'      => $groupId,
118 118
             'group_color'   => '7bd148'
119 119
         ];
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $groupId = end(self::$createdGroups)->group_id;
133 133
 
134
-        $removeParameters= [
134
+        $removeParameters = [
135 135
             'group_id' => $groupId
136 136
         ];
137 137
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
     public function testCreateAddressBookGroup()
148 148
     {
149
-        $createParameters= [
149
+        $createParameters = [
150 150
             'group_name'    => 'All Group',
151 151
             'group_color'   => '92e2cd',
152 152
             'filter'        => [
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         foreach (self::$createdGroups as $createdGroup) {
269 269
             $groupId = $createdGroup->group_id;
270 270
 
271
-            $removeParameters= [
271
+            $removeParameters = [
272 272
                 'group_id' => $groupId
273 273
             ];
274 274
 
Please login to merge, or discard this patch.