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 ( 733b13...0e4df4 )
by Igor
08:58 queued 13s
created
src/Route4Me/OptimizationProblem.php 2 patches
Indentation   +328 added lines, -328 removed lines patch added patch discarded remove patch
@@ -6,185 +6,185 @@  discard block
 block discarded – undo
6 6
 
7 7
 class OptimizationProblem extends Common
8 8
 {
9
-    /**
10
-     * Optimization problem ID
11
-     * @var string
12
-     */
13
-    public $optimization_problem_id;
14
-
15
-    /**
16
-     * Smart Optimization Problem ID
17
-     * @var string
18
-     */
19
-    public $smart_optimization_id;
20
-
21
-    /**
22
-     * An array of the user errors.
23
-     * @var string[]
24
-     */
25
-    public $user_errors = [];
26
-
27
-    /**
28
-     * An optimization problem state.<br>
29
-     * Available values:
30
-     * - OptimizationStateNew = 0,
31
-     * - Initial = 1,
32
-     * - MatrixProcessing = 2,
33
-     * - Optimizing = 3,
34
-     * - Optimized = 4,
35
-     * - Error = 5,
36
-     * - ComputingDirections = 6,
37
-     * - OptimizationStateInQueue = 7
38
-     * @var int
39
-     */
40
-    public $state;
41
-
42
-    /**
43
-     * An array of the optimization errors.
44
-     * @var string[]
45
-     */
46
-    public $optimization_errors = [];
47
-
48
-    /**
49
-     * Route Parameters.
50
-     * @var RouteParameters
51
-     */
52
-    public $parameters;
53
-
54
-    /**
55
-     * If true it means the solution was not returned (it is being computed in the background).
56
-     * @var boolean
57
-     */
58
-    public $sent_to_background;
59
-
60
-    /**
61
-     * When the optimization problem was created.
62
-     * @var long
63
-     */
64
-    public $created_timestamp;
65
-
66
-    /**
67
-     * An Unix Timestamp the Optimization Problem was scheduled for.
68
-     * @var long
69
-     */
70
-    public $scheduled_for;
71
-
72
-    /**
73
-     * When the optimization completed.
74
-     * @var long
75
-     */
76
-    public $optimization_completed_timestamp;
77
-
78
-    /**
79
-     * An array ot the Address type objects.
80
-     * @var Address[]
81
-     */
82
-    public $addresses = [];
83
-
84
-    /**
85
-     * An array ot the DataObjectRoute type objects.<br>
86
-     * The routes included in the optimization problem.
87
-     * @var Route[]
88
-     */
89
-    public $routes = [];
90
-
91
-    /** @var string[] $links
92
-     * The links to the GET operations for the optimization problem.
93
-     */
94
-    public $links = [];
95
-
96
-    public function __construct()
97
-    {
98
-        Route4Me::setBaseUrl(Endpoint::BASE_URL);
99
-        $this->parameters = new RouteParameters();
100
-    }
101
-
102
-    public static function fromArray(array $params)
103
-    {
104
-        $problem = new self();
105
-        $problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
106
-        $problem->user_errors = Common::getValue($params, 'user_errors', []);
107
-        $problem->state = Common::getValue($params, 'state', []);
108
-        $problem->sent_to_background = Common::getValue($params, 'sent_to_background', []);
109
-        $problem->links = Common::getValue($params, 'links', []);
110
-
111
-        if (isset($params['parameters'])) {
112
-            $problem->parameters = RouteParameters::fromArray($params['parameters']);
113
-        }
114
-
115
-        if (isset($params['addresses'])) {
116
-            $addresses = [];
117
-
118
-            foreach ($params['addresses'] as $address) {
119
-                $addresses[] = Address::fromArray($address);
120
-            }
121
-
122
-            $problem->addresses = $addresses;
123
-        }
124
-
125
-        if (isset($params['routes'])) {
126
-            $routes = [];
127
-
128
-            foreach ($params['routes'] as $route) {
129
-                $routes[] = Route::fromArray($route);
130
-            }
131
-
132
-            $problem->routes = $routes;
133
-        }
134
-
135
-        return $problem;
136
-    }
137
-
138
-    public static function optimize(OptimizationProblemParams $params)
139
-    {
140
-        $allQueryFields = ['redirect', 'directions', 'format', 'route_path_output', 'optimized_callback_url'];
141
-
142
-        $optimize = Route4Me::makeRequst([
143
-            'url'       => Endpoint::OPTIMIZATION_PROBLEM,
144
-            'method'    => 'POST',
145
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
146
-            'body'      => [
147
-                'addresses'     => $params->getAddressesArray(),
148
-                'depots'        => $params->getDepotsArray(),
149
-                'parameters'    => $params->getParametersArray(),
150
-            ],
151
-        ]);
152
-
153
-        return self::fromArray($optimize);
154
-    }
155
-
156
-    public static function get($params)
157
-    {
158
-        $allQueryFields = ['state', 'limit', 'format', 'offset',
159
-        'optimization_problem_id', 'wait_for_final_state','start_date','end_date', ];
160
-
161
-        $result = Route4Me::makeRequst([
162
-            'url'       => Endpoint::OPTIMIZATION_PROBLEM,
163
-            'method'    => 'GET',
164
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
165
-        ]);
166
-
167
-        if (isset($result['optimizations'])) {
168
-            $problems = [];
169
-
170
-            foreach ($result['optimizations'] as $problem) {
171
-                $problems[] = self::fromArray($problem);
172
-            }
173
-
174
-            return $problems;
175
-        } else {
176
-            return self::fromArray($result);
177
-        }
178
-    }
179
-
180
-    public function reoptimize($params)
181
-    {
182
-        $param['reoptimize'] = 1;
183
-
184
-        return self::update($params);
185
-    }
186
-
187
-    /*
9
+	/**
10
+	 * Optimization problem ID
11
+	 * @var string
12
+	 */
13
+	public $optimization_problem_id;
14
+
15
+	/**
16
+	 * Smart Optimization Problem ID
17
+	 * @var string
18
+	 */
19
+	public $smart_optimization_id;
20
+
21
+	/**
22
+	 * An array of the user errors.
23
+	 * @var string[]
24
+	 */
25
+	public $user_errors = [];
26
+
27
+	/**
28
+	 * An optimization problem state.<br>
29
+	 * Available values:
30
+	 * - OptimizationStateNew = 0,
31
+	 * - Initial = 1,
32
+	 * - MatrixProcessing = 2,
33
+	 * - Optimizing = 3,
34
+	 * - Optimized = 4,
35
+	 * - Error = 5,
36
+	 * - ComputingDirections = 6,
37
+	 * - OptimizationStateInQueue = 7
38
+	 * @var int
39
+	 */
40
+	public $state;
41
+
42
+	/**
43
+	 * An array of the optimization errors.
44
+	 * @var string[]
45
+	 */
46
+	public $optimization_errors = [];
47
+
48
+	/**
49
+	 * Route Parameters.
50
+	 * @var RouteParameters
51
+	 */
52
+	public $parameters;
53
+
54
+	/**
55
+	 * If true it means the solution was not returned (it is being computed in the background).
56
+	 * @var boolean
57
+	 */
58
+	public $sent_to_background;
59
+
60
+	/**
61
+	 * When the optimization problem was created.
62
+	 * @var long
63
+	 */
64
+	public $created_timestamp;
65
+
66
+	/**
67
+	 * An Unix Timestamp the Optimization Problem was scheduled for.
68
+	 * @var long
69
+	 */
70
+	public $scheduled_for;
71
+
72
+	/**
73
+	 * When the optimization completed.
74
+	 * @var long
75
+	 */
76
+	public $optimization_completed_timestamp;
77
+
78
+	/**
79
+	 * An array ot the Address type objects.
80
+	 * @var Address[]
81
+	 */
82
+	public $addresses = [];
83
+
84
+	/**
85
+	 * An array ot the DataObjectRoute type objects.<br>
86
+	 * The routes included in the optimization problem.
87
+	 * @var Route[]
88
+	 */
89
+	public $routes = [];
90
+
91
+	/** @var string[] $links
92
+	 * The links to the GET operations for the optimization problem.
93
+	 */
94
+	public $links = [];
95
+
96
+	public function __construct()
97
+	{
98
+		Route4Me::setBaseUrl(Endpoint::BASE_URL);
99
+		$this->parameters = new RouteParameters();
100
+	}
101
+
102
+	public static function fromArray(array $params)
103
+	{
104
+		$problem = new self();
105
+		$problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
106
+		$problem->user_errors = Common::getValue($params, 'user_errors', []);
107
+		$problem->state = Common::getValue($params, 'state', []);
108
+		$problem->sent_to_background = Common::getValue($params, 'sent_to_background', []);
109
+		$problem->links = Common::getValue($params, 'links', []);
110
+
111
+		if (isset($params['parameters'])) {
112
+			$problem->parameters = RouteParameters::fromArray($params['parameters']);
113
+		}
114
+
115
+		if (isset($params['addresses'])) {
116
+			$addresses = [];
117
+
118
+			foreach ($params['addresses'] as $address) {
119
+				$addresses[] = Address::fromArray($address);
120
+			}
121
+
122
+			$problem->addresses = $addresses;
123
+		}
124
+
125
+		if (isset($params['routes'])) {
126
+			$routes = [];
127
+
128
+			foreach ($params['routes'] as $route) {
129
+				$routes[] = Route::fromArray($route);
130
+			}
131
+
132
+			$problem->routes = $routes;
133
+		}
134
+
135
+		return $problem;
136
+	}
137
+
138
+	public static function optimize(OptimizationProblemParams $params)
139
+	{
140
+		$allQueryFields = ['redirect', 'directions', 'format', 'route_path_output', 'optimized_callback_url'];
141
+
142
+		$optimize = Route4Me::makeRequst([
143
+			'url'       => Endpoint::OPTIMIZATION_PROBLEM,
144
+			'method'    => 'POST',
145
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
146
+			'body'      => [
147
+				'addresses'     => $params->getAddressesArray(),
148
+				'depots'        => $params->getDepotsArray(),
149
+				'parameters'    => $params->getParametersArray(),
150
+			],
151
+		]);
152
+
153
+		return self::fromArray($optimize);
154
+	}
155
+
156
+	public static function get($params)
157
+	{
158
+		$allQueryFields = ['state', 'limit', 'format', 'offset',
159
+		'optimization_problem_id', 'wait_for_final_state','start_date','end_date', ];
160
+
161
+		$result = Route4Me::makeRequst([
162
+			'url'       => Endpoint::OPTIMIZATION_PROBLEM,
163
+			'method'    => 'GET',
164
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
165
+		]);
166
+
167
+		if (isset($result['optimizations'])) {
168
+			$problems = [];
169
+
170
+			foreach ($result['optimizations'] as $problem) {
171
+				$problems[] = self::fromArray($problem);
172
+			}
173
+
174
+			return $problems;
175
+		} else {
176
+			return self::fromArray($result);
177
+		}
178
+	}
179
+
180
+	public function reoptimize($params)
181
+	{
182
+		$param['reoptimize'] = 1;
183
+
184
+		return self::update($params);
185
+	}
186
+
187
+	/*
188 188
      * Updates an existing optimization problem.<br>
189 189
      * @param array $params with items:
190 190
      * - optimization_problem_id   : query parameter. ID of an updated optimization;
@@ -193,157 +193,157 @@  discard block
 block discarded – undo
193 193
      * - parameters                : body parameter. Modified route parameters;
194 194
      * @return Optimization problem
195 195
      */
196
-    public static function update($params)
197
-    {
198
-        $allQueryFields = ['optimization_problem_id', 'reoptimize'];
199
-        $allBodyFields = ['addresses', 'parameters'];
200
-        $query = null;
201
-        $body = null;
202
-
203
-        if (is_array($params)) {
204
-            if (isset($params['optimization_problem_id']) || isset($params['parameters'])) {
205
-                $query = Route4Me::generateRequestParameters($allQueryFields, $params);
206
-            }
207
-
208
-            if ((isset($params['addresses']) && sizeof($params['addresses']) > 0)
209
-                || (isset($params['parameters']) && sizeof($params['parameters']) > 0)
210
-            ) {
211
-                $body = Route4Me::generateRequestParameters($allBodyFields, $params);
212
-            }
213
-        } else {
214
-            if (isset($params->optimization_problem_id) || isset($params->parameters)) {
215
-                $query = Route4Me::generateRequestParameters($allQueryFields, $params);
216
-            }
217
-
218
-            if ((isset($params->addresses) && sizeof($params->addresses) > 0)
219
-                || (isset($params->parameters) && sizeof($params->parameters) > 0)
220
-            ) {
221
-                $body = Route4Me::generateRequestParameters($allBodyFields, $params);
222
-            }
223
-        }
224
-
225
-        $optimize = Route4Me::makeRequst([
226
-            'url'       => Endpoint::OPTIMIZATION_PROBLEM,
227
-            'method'    => 'PUT',
228
-            'query'     => $query,
229
-            'body'      => $body,
230
-        ]);
231
-
232
-        return $optimize;
233
-    }
234
-
235
-    public function getOptimizationId()
236
-    {
237
-        return $this->optimization_problem_id;
238
-    }
239
-
240
-    public function getRoutes()
241
-    {
242
-        return $this->routes;
243
-    }
244
-
245
-    public function getRandomOptimizationId($offset, $limit)
246
-    {
247
-        $optimizations = self::get(['offset' => $offset, 'limit' => $limit]);
248
-
249
-        $rOptimization = $optimizations[rand(0, sizeof($optimizations) - 1)];
250
-
251
-        if (!isset($rOptimization->optimization_problem_id)) {
252
-            if (sizeof($optimizations) > 9) {
253
-                $this->getRandomOptimizationId($offset, $limit);
254
-            } else {
255
-                return null;
256
-            }
257
-        }
258
-
259
-        return $rOptimization->optimization_problem_id;
260
-    }
261
-
262
-    public function getAddresses($opt_id)
263
-    {
264
-        if (null == $opt_id) {
265
-            return null;
266
-        }
267
-
268
-        $params = ['optimization_problem_id' => $opt_id];
269
-
270
-        $optimization = (array) $this->get($params);
271
-
272
-        $addresses = $optimization['addresses'];
273
-
274
-        return $addresses;
275
-    }
276
-
277
-    public function getRandomAddressFromOptimization($opt_id)
278
-    {
279
-        $addresses = (array) $this->getAddresses($opt_id);
280
-
281
-        if (null == $addresses) {
282
-            echo 'There are no addresses in this optimization!.. Try again.';
283
-
284
-            return null;
285
-        }
286
-
287
-        $num = rand(0, sizeof($addresses) - 1);
288
-
289
-        $rAddress = $addresses[$num];
290
-
291
-        return $rAddress;
292
-    }
293
-
294
-    public function removeAddress($params)
295
-    {
296
-        $allQueryFields = ['optimization_problem_id', 'route_destination_id'];
297
-
298
-        $response = Route4Me::makeRequst([
299
-            'url'       => Endpoint::ADDRESS_V4,
300
-            'method'    => 'DELETE',
301
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
302
-        ]);
303
-
304
-        return $response;
305
-    }
306
-
307
-    public function removeOptimization($params)
308
-    {
309
-        $allQueryFields = ['redirect'];
310
-        $allBodyFields = ['optimization_problem_ids'];
311
-
312
-        $response = Route4Me::makeRequst([
313
-            'url'       => Endpoint::OPTIMIZATION_PROBLEM,
314
-            'method'    => 'DELETE',
315
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
316
-            'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
317
-        ]);
318
-
319
-        return $response;
320
-    }
321
-
322
-    public function getHybridOptimization($params)
323
-    {
324
-        $allQueryFields = ['target_date_string', 'timezone_offset_minutes'];
325
-
326
-        $optimize = Route4Me::makeRequst([
327
-            'url'       => Endpoint::HYBRID_DATE_OPTIMIZATION,
328
-            'method'    => 'GET',
329
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
330
-        ]);
196
+	public static function update($params)
197
+	{
198
+		$allQueryFields = ['optimization_problem_id', 'reoptimize'];
199
+		$allBodyFields = ['addresses', 'parameters'];
200
+		$query = null;
201
+		$body = null;
202
+
203
+		if (is_array($params)) {
204
+			if (isset($params['optimization_problem_id']) || isset($params['parameters'])) {
205
+				$query = Route4Me::generateRequestParameters($allQueryFields, $params);
206
+			}
207
+
208
+			if ((isset($params['addresses']) && sizeof($params['addresses']) > 0)
209
+				|| (isset($params['parameters']) && sizeof($params['parameters']) > 0)
210
+			) {
211
+				$body = Route4Me::generateRequestParameters($allBodyFields, $params);
212
+			}
213
+		} else {
214
+			if (isset($params->optimization_problem_id) || isset($params->parameters)) {
215
+				$query = Route4Me::generateRequestParameters($allQueryFields, $params);
216
+			}
217
+
218
+			if ((isset($params->addresses) && sizeof($params->addresses) > 0)
219
+				|| (isset($params->parameters) && sizeof($params->parameters) > 0)
220
+			) {
221
+				$body = Route4Me::generateRequestParameters($allBodyFields, $params);
222
+			}
223
+		}
224
+
225
+		$optimize = Route4Me::makeRequst([
226
+			'url'       => Endpoint::OPTIMIZATION_PROBLEM,
227
+			'method'    => 'PUT',
228
+			'query'     => $query,
229
+			'body'      => $body,
230
+		]);
231
+
232
+		return $optimize;
233
+	}
234
+
235
+	public function getOptimizationId()
236
+	{
237
+		return $this->optimization_problem_id;
238
+	}
239
+
240
+	public function getRoutes()
241
+	{
242
+		return $this->routes;
243
+	}
244
+
245
+	public function getRandomOptimizationId($offset, $limit)
246
+	{
247
+		$optimizations = self::get(['offset' => $offset, 'limit' => $limit]);
248
+
249
+		$rOptimization = $optimizations[rand(0, sizeof($optimizations) - 1)];
250
+
251
+		if (!isset($rOptimization->optimization_problem_id)) {
252
+			if (sizeof($optimizations) > 9) {
253
+				$this->getRandomOptimizationId($offset, $limit);
254
+			} else {
255
+				return null;
256
+			}
257
+		}
258
+
259
+		return $rOptimization->optimization_problem_id;
260
+	}
261
+
262
+	public function getAddresses($opt_id)
263
+	{
264
+		if (null == $opt_id) {
265
+			return null;
266
+		}
267
+
268
+		$params = ['optimization_problem_id' => $opt_id];
269
+
270
+		$optimization = (array) $this->get($params);
271
+
272
+		$addresses = $optimization['addresses'];
273
+
274
+		return $addresses;
275
+	}
276
+
277
+	public function getRandomAddressFromOptimization($opt_id)
278
+	{
279
+		$addresses = (array) $this->getAddresses($opt_id);
280
+
281
+		if (null == $addresses) {
282
+			echo 'There are no addresses in this optimization!.. Try again.';
283
+
284
+			return null;
285
+		}
286
+
287
+		$num = rand(0, sizeof($addresses) - 1);
288
+
289
+		$rAddress = $addresses[$num];
290
+
291
+		return $rAddress;
292
+	}
293
+
294
+	public function removeAddress($params)
295
+	{
296
+		$allQueryFields = ['optimization_problem_id', 'route_destination_id'];
297
+
298
+		$response = Route4Me::makeRequst([
299
+			'url'       => Endpoint::ADDRESS_V4,
300
+			'method'    => 'DELETE',
301
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
302
+		]);
303
+
304
+		return $response;
305
+	}
306
+
307
+	public function removeOptimization($params)
308
+	{
309
+		$allQueryFields = ['redirect'];
310
+		$allBodyFields = ['optimization_problem_ids'];
311
+
312
+		$response = Route4Me::makeRequst([
313
+			'url'       => Endpoint::OPTIMIZATION_PROBLEM,
314
+			'method'    => 'DELETE',
315
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
316
+			'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
317
+		]);
318
+
319
+		return $response;
320
+	}
321
+
322
+	public function getHybridOptimization($params)
323
+	{
324
+		$allQueryFields = ['target_date_string', 'timezone_offset_minutes'];
325
+
326
+		$optimize = Route4Me::makeRequst([
327
+			'url'       => Endpoint::HYBRID_DATE_OPTIMIZATION,
328
+			'method'    => 'GET',
329
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
330
+		]);
331 331
 
332
-        return $optimize;
333
-    }
332
+		return $optimize;
333
+	}
334 334
 
335
-    public function addDepotsToHybrid($params)
336
-    {
337
-        $allQueryFields = ['optimization_problem_id'];
338
-        $allBodyFields = ['optimization_problem_id', 'delete_old_depots', 'new_depots'];
335
+	public function addDepotsToHybrid($params)
336
+	{
337
+		$allQueryFields = ['optimization_problem_id'];
338
+		$allBodyFields = ['optimization_problem_id', 'delete_old_depots', 'new_depots'];
339 339
 
340
-        $depots = Route4Me::makeRequst([
341
-            'url'       => Endpoint::CHANGE_HYBRID_OPTIMIZATION_DEPOT,
342
-            'method'    => 'POST',
343
-            'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
344
-            'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
345
-        ]);
340
+		$depots = Route4Me::makeRequst([
341
+			'url'       => Endpoint::CHANGE_HYBRID_OPTIMIZATION_DEPOT,
342
+			'method'    => 'POST',
343
+			'query'     => Route4Me::generateRequestParameters($allQueryFields, $params),
344
+			'body'      => Route4Me::generateRequestParameters($allBodyFields, $params),
345
+		]);
346 346
 
347
-        return $depots;
348
-    }
347
+		return $depots;
348
+	}
349 349
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     public static function get($params)
157 157
     {
158 158
         $allQueryFields = ['state', 'limit', 'format', 'offset',
159
-        'optimization_problem_id', 'wait_for_final_state','start_date','end_date', ];
159
+        'optimization_problem_id', 'wait_for_final_state', 'start_date', 'end_date', ];
160 160
 
161 161
         $result = Route4Me::makeRequst([
162 162
             'url'       => Endpoint::OPTIMIZATION_PROBLEM,
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
                 $query = Route4Me::generateRequestParameters($allQueryFields, $params);
206 206
             }
207 207
 
208
-            if ((isset($params['addresses']) && sizeof($params['addresses']) > 0)
209
-                || (isset($params['parameters']) && sizeof($params['parameters']) > 0)
208
+            if ((isset($params['addresses']) && sizeof($params['addresses'])>0)
209
+                || (isset($params['parameters']) && sizeof($params['parameters'])>0)
210 210
             ) {
211 211
                 $body = Route4Me::generateRequestParameters($allBodyFields, $params);
212 212
             }
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
                 $query = Route4Me::generateRequestParameters($allQueryFields, $params);
216 216
             }
217 217
 
218
-            if ((isset($params->addresses) && sizeof($params->addresses) > 0)
219
-                || (isset($params->parameters) && sizeof($params->parameters) > 0)
218
+            if ((isset($params->addresses) && sizeof($params->addresses)>0)
219
+                || (isset($params->parameters) && sizeof($params->parameters)>0)
220 220
             ) {
221 221
                 $body = Route4Me::generateRequestParameters($allBodyFields, $params);
222 222
             }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
         $rOptimization = $optimizations[rand(0, sizeof($optimizations) - 1)];
250 250
 
251 251
         if (!isset($rOptimization->optimization_problem_id)) {
252
-            if (sizeof($optimizations) > 9) {
252
+            if (sizeof($optimizations)>9) {
253 253
                 $this->getRandomOptimizationId($offset, $limit);
254 254
             } else {
255 255
                 return null;
@@ -261,13 +261,13 @@  discard block
 block discarded – undo
261 261
 
262 262
     public function getAddresses($opt_id)
263 263
     {
264
-        if (null == $opt_id) {
264
+        if (null==$opt_id) {
265 265
             return null;
266 266
         }
267 267
 
268 268
         $params = ['optimization_problem_id' => $opt_id];
269 269
 
270
-        $optimization = (array) $this->get($params);
270
+        $optimization = (array)$this->get($params);
271 271
 
272 272
         $addresses = $optimization['addresses'];
273 273
 
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 
277 277
     public function getRandomAddressFromOptimization($opt_id)
278 278
     {
279
-        $addresses = (array) $this->getAddresses($opt_id);
279
+        $addresses = (array)$this->getAddresses($opt_id);
280 280
 
281
-        if (null == $addresses) {
281
+        if (null==$addresses) {
282 282
             echo 'There are no addresses in this optimization!.. Try again.';
283 283
 
284 284
             return null;
Please login to merge, or discard this patch.