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 ( 5793f9...e93048 )
by Oleg
04:32
created
src/Route4Me/OptimizationProblem.php 1 patch
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -12,156 +12,156 @@  discard block
 block discarded – undo
12 12
 
13 13
 class OptimizationProblem extends Common
14 14
 {
15
-    static public $apiUrl = '/api.v4/optimization_problem.php';
15
+	static public $apiUrl = '/api.v4/optimization_problem.php';
16 16
 	static public $apiUrl_addr = '/api.v4/address.php';
17
-    static public $apiHybridUrl = '/api.v4/hybrid_date_optimization.php';
18
-    static public $apiHybridDepotUrl = '/api/change_hybrid_optimization_depot.php';
17
+	static public $apiHybridUrl = '/api.v4/hybrid_date_optimization.php';
18
+	static public $apiHybridDepotUrl = '/api/change_hybrid_optimization_depot.php';
19 19
 
20
-    public $optimization_problem_id;
21
-    public $user_errors = array();
22
-    public $state;
23
-    public $parameters;
24
-    public $sent_to_background;
25
-    public $addresses = array();
26
-    public $routes = array();
27
-    public $links = array();
20
+	public $optimization_problem_id;
21
+	public $user_errors = array();
22
+	public $state;
23
+	public $parameters;
24
+	public $sent_to_background;
25
+	public $addresses = array();
26
+	public $routes = array();
27
+	public $links = array();
28 28
 
29
-    function __construct()
30
-    {
31
-        $this->parameters = new RouteParameters;
32
-    }
29
+	function __construct()
30
+	{
31
+		$this->parameters = new RouteParameters;
32
+	}
33 33
 
34
-    public static function fromArray(array $params)
35
-    {
36
-        $problem = new OptimizationProblem;
37
-        $problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
38
-        $problem->user_errors = Common::getValue($params, 'user_errors', array());
39
-        $problem->state = Common::getValue($params, 'state', array());
40
-        $problem->sent_to_background = Common::getValue($params, 'sent_to_background', array());
41
-        $problem->links = Common::getValue($params, 'links', array());
34
+	public static function fromArray(array $params)
35
+	{
36
+		$problem = new OptimizationProblem;
37
+		$problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
38
+		$problem->user_errors = Common::getValue($params, 'user_errors', array());
39
+		$problem->state = Common::getValue($params, 'state', array());
40
+		$problem->sent_to_background = Common::getValue($params, 'sent_to_background', array());
41
+		$problem->links = Common::getValue($params, 'links', array());
42 42
 
43
-        if (isset($params['parameters'])) {
44
-            $problem->parameters = RouteParameters::fromArray($params['parameters']);
45
-        }
43
+		if (isset($params['parameters'])) {
44
+			$problem->parameters = RouteParameters::fromArray($params['parameters']);
45
+		}
46 46
 
47
-        if (isset($params['addresses'])) {
48
-            $addresses = array();
49
-            foreach ($params['addresses'] as $address) {
50
-                $addresses[] = Address::fromArray($address);
51
-            }
52
-            $problem->addresses = $addresses;
53
-        }
47
+		if (isset($params['addresses'])) {
48
+			$addresses = array();
49
+			foreach ($params['addresses'] as $address) {
50
+				$addresses[] = Address::fromArray($address);
51
+			}
52
+			$problem->addresses = $addresses;
53
+		}
54 54
 
55
-        if (isset($params['routes'])) {
56
-            $routes = array();
57
-            foreach ($params['routes'] as $route) {
58
-                $routes[] = Route::fromArray($address);
59
-            }
60
-            $problem->routes = $routes;
61
-        }
55
+		if (isset($params['routes'])) {
56
+			$routes = array();
57
+			foreach ($params['routes'] as $route) {
58
+				$routes[] = Route::fromArray($address);
59
+			}
60
+			$problem->routes = $routes;
61
+		}
62 62
 
63
-        return $problem;
64
-    }
63
+		return $problem;
64
+	}
65 65
 
66
-    public static function optimize(OptimizationProblemParams $params)
67
-    {
68
-        $optimize = Route4Me::makeRequst(array(
69
-            'url'    => self::$apiUrl,
70
-            'method' => 'POST',
71
-            'query'  => array(
72
-                'directions'             => isset($params->directions) ? $params->directions: null, 
73
-                'format'                 => isset($params->format) ? $params->format: null,
74
-                'route_path_output'      => isset($params->route_path_output) ? $params->route_path_output: null,
75
-                'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url: null
76
-            ),
77
-            'body'   => array(
78
-                'addresses'  => $params->getAddressesArray(),
79
-                'parameters' => $params->getParametersArray()
80
-            )
81
-        ));
66
+	public static function optimize(OptimizationProblemParams $params)
67
+	{
68
+		$optimize = Route4Me::makeRequst(array(
69
+			'url'    => self::$apiUrl,
70
+			'method' => 'POST',
71
+			'query'  => array(
72
+				'directions'             => isset($params->directions) ? $params->directions: null, 
73
+				'format'                 => isset($params->format) ? $params->format: null,
74
+				'route_path_output'      => isset($params->route_path_output) ? $params->route_path_output: null,
75
+				'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url: null
76
+			),
77
+			'body'   => array(
78
+				'addresses'  => $params->getAddressesArray(),
79
+				'parameters' => $params->getParametersArray()
80
+			)
81
+		));
82 82
 
83
-        return OptimizationProblem::fromArray($optimize);
84
-    }
83
+		return OptimizationProblem::fromArray($optimize);
84
+	}
85 85
 
86
-    public static function get($params)
87
-    {
88
-        $optimize = Route4Me::makeRequst(array(
89
-            'url'    => self::$apiUrl,
90
-            'method' => 'GET',
91
-            'query'  => array(
92
-                'state' => isset($params['state']) ? $params['state'] : null,
93
-                'limit' => isset($params['limit']) ? $params['limit'] : null,
94
-                'offset' => isset($params['offset']) ? $params['offset'] : null,
95
-                'optimization_problem_id' => isset($params['optimization_problem_id']) 
96
-                    ? $params['optimization_problem_id'] : null,
97
-                'wait_for_final_state' => isset($params['wait_for_final_state']) 
98
-                    ? $params['wait_for_final_state'] : null,
99
-            )
100
-        ));
86
+	public static function get($params)
87
+	{
88
+		$optimize = Route4Me::makeRequst(array(
89
+			'url'    => self::$apiUrl,
90
+			'method' => 'GET',
91
+			'query'  => array(
92
+				'state' => isset($params['state']) ? $params['state'] : null,
93
+				'limit' => isset($params['limit']) ? $params['limit'] : null,
94
+				'offset' => isset($params['offset']) ? $params['offset'] : null,
95
+				'optimization_problem_id' => isset($params['optimization_problem_id']) 
96
+					? $params['optimization_problem_id'] : null,
97
+				'wait_for_final_state' => isset($params['wait_for_final_state']) 
98
+					? $params['wait_for_final_state'] : null,
99
+			)
100
+		));
101 101
 
102
-        if (isset($optimize['optimizations'])) {
103
-            $problems = array();
104
-            foreach($optimize['optimizations'] as $problem) {
105
-                $problems[] = OptimizationProblem::fromArray($problem);
106
-            }
107
-            return $problems;
108
-        } else {
109
-            return OptimizationProblem::fromArray($optimize);
110
-        }
111
-    }
102
+		if (isset($optimize['optimizations'])) {
103
+			$problems = array();
104
+			foreach($optimize['optimizations'] as $problem) {
105
+				$problems[] = OptimizationProblem::fromArray($problem);
106
+			}
107
+			return $problems;
108
+		} else {
109
+			return OptimizationProblem::fromArray($optimize);
110
+		}
111
+	}
112 112
 
113
-    public static function reoptimize($params)
114
-    {
115
-        $param = new OptimizationProblemParams;
116
-        $param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null;
117
-        $param->reoptimize = 1;
113
+	public static function reoptimize($params)
114
+	{
115
+		$param = new OptimizationProblemParams;
116
+		$param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null;
117
+		$param->reoptimize = 1;
118 118
 
119
-        return self::update((array)$param);
120
-    }
119
+		return self::update((array)$param);
120
+	}
121 121
 
122
-    public static function update($params)
123
-    {
122
+	public static function update($params)
123
+	{
124 124
 		$optimize = Route4Me::makeRequst(array(
125
-            'url'    => self::$apiUrl,
126
-            'method' => 'PUT',
127
-            'query'  => array(
128
-                'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
129
-                'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
130
-                'reoptimize' => isset($params['reoptimize']) ? $params['reoptimize'] : null,
131
-            )
132
-        ));
125
+			'url'    => self::$apiUrl,
126
+			'method' => 'PUT',
127
+			'query'  => array(
128
+				'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
129
+				'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
130
+				'reoptimize' => isset($params['reoptimize']) ? $params['reoptimize'] : null,
131
+			)
132
+		));
133 133
 		
134 134
 		return $optimize;
135
-    }
135
+	}
136 136
 
137
-    public function getOptimizationId()
138
-    {
139
-        return $this->optimization_problem_id;
140
-    }
137
+	public function getOptimizationId()
138
+	{
139
+		return $this->optimization_problem_id;
140
+	}
141 141
 
142
-    public function getRoutes()
143
-    {
144
-        return $this->routes;
145
-    }
142
+	public function getRoutes()
143
+	{
144
+		return $this->routes;
145
+	}
146 146
 	
147 147
 	public function getRandomOptimizationId($offset,$limit)
148 148
 	{
149 149
 		$query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
150
-        $query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
150
+		$query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
151 151
 			
152 152
 		$json = Route4Me::makeRequst(array(
153
-            'url'    => self::$apiUrl,
154
-            'method' => 'GET',
155
-            'query'  => $query
156
-        ));
153
+			'url'    => self::$apiUrl,
154
+			'method' => 'GET',
155
+			'query'  => $query
156
+		));
157 157
 		
158 158
 		$optimizations = array();
159
-            foreach($json as $optimization) {
159
+			foreach($json as $optimization) {
160 160
 				if (gettype($optimization)!="array") continue;
161 161
 				foreach ($optimization as $otp1) {
162 162
 					$optimizations[] = $otp1;
163 163
 				}
164
-            }
164
+			}
165 165
 			
166 166
 			$num=rand(0,sizeof($optimizations)-1);
167 167
 			//echo "num=$num.<br>".sizeof($optimizations)."<br>";
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
 	public function removeAddress($params)
202 202
 	{
203 203
 		$response = Route4Me::makeRequst(array(
204
-            'url'    => self::$apiUrl_addr,
205
-            'method' => 'DELETE',
206
-            'query'  => array(
207
-                'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
208
-                'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
209
-            )
210
-        ));
204
+			'url'    => self::$apiUrl_addr,
205
+			'method' => 'DELETE',
206
+			'query'  => array(
207
+				'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
208
+				'route_destination_id' => isset($params['route_destination_id']) ? $params['route_destination_id'] : null,
209
+			)
210
+		));
211 211
 		
212 212
 		return $response;
213 213
 	}
@@ -215,48 +215,48 @@  discard block
 block discarded – undo
215 215
 	public function removeOptimization($params)
216 216
 	{
217 217
 		$response = Route4Me::makeRequst(array(
218
-            'url'    => self::$apiUrl,
219
-            'method' => 'DELETE',
220
-            'query'  => array(
221
-                'redirect' => isset($params['redirect']) ? $params['redirect'] : null,
222
-            ),
223
-            'body'  => array(
218
+			'url'    => self::$apiUrl,
219
+			'method' => 'DELETE',
220
+			'query'  => array(
221
+				'redirect' => isset($params['redirect']) ? $params['redirect'] : null,
222
+			),
223
+			'body'  => array(
224 224
 				'optimization_problem_ids' => isset($params['optimization_problem_ids']) ? $params['optimization_problem_ids'] : null,
225 225
 			)
226
-        ));
226
+		));
227 227
 		
228 228
 		return $response;
229 229
 	}
230 230
     
231
-    public function getHybridOptimization($params)
232
-    {
233
-        $optimize = Route4Me::makeRequst(array(
234
-            'url'    => self::$apiHybridUrl,
235
-            'method' => 'GET',
236
-            'query'  => array(
237
-                'target_date_string' => isset($params['target_date_string']) ? $params['target_date_string'] : null,
238
-                'timezone_offset_minutes' => isset($params['timezone_offset_minutes']) ? $params['timezone_offset_minutes'] : null
239
-            )
240
-        ));
231
+	public function getHybridOptimization($params)
232
+	{
233
+		$optimize = Route4Me::makeRequst(array(
234
+			'url'    => self::$apiHybridUrl,
235
+			'method' => 'GET',
236
+			'query'  => array(
237
+				'target_date_string' => isset($params['target_date_string']) ? $params['target_date_string'] : null,
238
+				'timezone_offset_minutes' => isset($params['timezone_offset_minutes']) ? $params['timezone_offset_minutes'] : null
239
+			)
240
+		));
241 241
 
242
-        return $optimize;
243
-    }
242
+		return $optimize;
243
+	}
244 244
     
245
-    Public function addDepotsToHybrid($params)
246
-    {
247
-        $depots = Route4Me::makeRequst(array( 
248
-            'url'    => self::$apiHybridDepotUrl,
249
-            'method' => 'POST',
250
-            'query'  => array(
251
-                'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
252
-                ),
253
-            'body'  => array(
254
-                'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
255
-                'delete_old_depots' => isset($params['delete_old_depots']) ? $params['delete_old_depots'] : null,
256
-                'new_depots' => isset($params['new_depots']) ? $params['new_depots'] : null,
257
-            )
258
-        ));
245
+	Public function addDepotsToHybrid($params)
246
+	{
247
+		$depots = Route4Me::makeRequst(array( 
248
+			'url'    => self::$apiHybridDepotUrl,
249
+			'method' => 'POST',
250
+			'query'  => array(
251
+				'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
252
+				),
253
+			'body'  => array(
254
+				'optimization_problem_id' => isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
255
+				'delete_old_depots' => isset($params['delete_old_depots']) ? $params['delete_old_depots'] : null,
256
+				'new_depots' => isset($params['new_depots']) ? $params['new_depots'] : null,
257
+			)
258
+		));
259 259
         
260
-        return $depots;
261
-    }
260
+		return $depots;
261
+	}
262 262
 }
Please login to merge, or discard this patch.
src/Route4Me/AddressBookLocation.php 1 patch
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 		public $address_zip;
24 24
 		public $cached_lat;
25 25
 		public $cached_lng;
26
-        public $curbside_lat;
27
-        public $curbside_lng;
26
+		public $curbside_lat;
27
+		public $curbside_lng;
28 28
 		public $color;
29
-        public $address_custom_data;
30
-        public $schedule;
29
+		public $address_custom_data;
30
+		public $schedule;
31 31
 		
32 32
 		//public $offset;
33 33
 		//public $limit;
@@ -36,242 +36,242 @@  discard block
 block discarded – undo
36 36
 		
37 37
 		public static function fromArray(array $params) {
38 38
 			$addressbooklocation = new AddressBookLocation();
39
-	        foreach($params as $key => $value) {
40
-	            if (property_exists($addressbooklocation, $key)) {
41
-	                $addressbooklocation->{$key} = $value;
42
-	            }
39
+			foreach($params as $key => $value) {
40
+				if (property_exists($addressbooklocation, $key)) {
41
+					$addressbooklocation->{$key} = $value;
42
+				}
43 43
 			}
44 44
 			
45 45
 			return $addressbooklocation;
46 46
 		}
47 47
 		
48 48
 		public static function getAddressBookLocation($addressId)
49
-	    {
50
-	    	$ablocations = Route4Me::makeRequst(array(
51
-	            'url'    => self::$apiUrl,
52
-	            'method' => 'GET',
53
-	            'query'  => array(
54
-	                'query' => $addressId,
55
-	                'limit' => 30
56
-	            )
57
-	        ));
49
+		{
50
+			$ablocations = Route4Me::makeRequst(array(
51
+				'url'    => self::$apiUrl,
52
+				'method' => 'GET',
53
+				'query'  => array(
54
+					'query' => $addressId,
55
+					'limit' => 30
56
+				)
57
+			));
58 58
 
59 59
 			return $ablocations;
60 60
 		}
61 61
 		
62 62
 		public static function searchRoutedLocation($params)
63
-	    {
64
-	    	$result= Route4Me::makeRequst(array(
65
-	            'url'    => self::$apiUrl,
66
-	            'method' => 'GET',
67
-	            'query'  => array(
68
-	                'display' => isset($params['display']) ? $params['display']: null,
69
-	                'query' => isset($params['query']) ? $params['query']: null,
70
-	                'fields' => isset($params['fields']) ? $params['fields']: null,
71
-	                'limit' => isset($params['limit']) ? $params['limit']: null,
72
-	                'offset' => isset($params['offset']) ? $params['offset'] : null,
73
-	            )
74
-	        ));
63
+		{
64
+			$result= Route4Me::makeRequst(array(
65
+				'url'    => self::$apiUrl,
66
+				'method' => 'GET',
67
+				'query'  => array(
68
+					'display' => isset($params['display']) ? $params['display']: null,
69
+					'query' => isset($params['query']) ? $params['query']: null,
70
+					'fields' => isset($params['fields']) ? $params['fields']: null,
71
+					'limit' => isset($params['limit']) ? $params['limit']: null,
72
+					'offset' => isset($params['offset']) ? $params['offset'] : null,
73
+				)
74
+			));
75 75
 
76 76
 			return $result;
77 77
 		}
78 78
 		
79 79
 		public static function getAddressBookLocations($params)
80
-	    {
81
-	    	$ablocations = Route4Me::makeRequst(array(
82
-	            'url'    => self::$apiUrl,
83
-	            'method' => 'GET',
84
-	            'query'  => array(
85
-	                'limit' => isset($params->limit) ? $params->limit: null,
86
-	                'offset' => isset($params->offset) ? $params->offset : null,
87
-	            )
88
-	        ));
80
+		{
81
+			$ablocations = Route4Me::makeRequst(array(
82
+				'url'    => self::$apiUrl,
83
+				'method' => 'GET',
84
+				'query'  => array(
85
+					'limit' => isset($params->limit) ? $params->limit: null,
86
+					'offset' => isset($params->offset) ? $params->offset : null,
87
+				)
88
+			));
89 89
 
90 90
 			return $ablocations;
91 91
 		}
92 92
 		
93 93
 		public static function getAddressBookLocationsByIds($ids)
94
-	    {
95
-	    	$ablocations = Route4Me::makeRequst(array(
96
-	            'url'    => self::$apiUrl,
97
-	            'method' => 'GET',
98
-	            'query'  => array(
99
-	                'address_id' => $ids
100
-	            )
101
-	        ));
94
+		{
95
+			$ablocations = Route4Me::makeRequst(array(
96
+				'url'    => self::$apiUrl,
97
+				'method' => 'GET',
98
+				'query'  => array(
99
+					'address_id' => $ids
100
+				)
101
+			));
102 102
 
103 103
 			return $ablocations;
104 104
 		}
105 105
 		
106 106
 		public static function addAdressBookLocation($params)
107
-	    {
108
-	    	$ablocations = Route4Me::makeRequst(array(
109
-	            'url'    => self::$apiUrl,
110
-	            'method' => 'POST',
111
-	            'body'  => array(
112
-	            	'address_1' => 	isset($params->address_1) ? $params->address_1: null,
113
-	            	'address_2' =>    isset($params->address_2) ? $params->address_2: null,
114
-	            	'address_alias' =>    isset($params->address_alias) ? $params->address_alias: null,
115
-	                'first_name' => isset($params->first_name) ? $params->first_name : null,
116
-	                'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
117
-	                'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
118
-	                'curbside_lat' => isset($params->curbside_lat) ? $params->curbside_lat : null,
119
-                    'curbside_lng' => isset($params->curbside_lng) ? $params->curbside_lng : null,
120
-	                'address_phone_number' =>    isset($params->address_phone_number) ? $params->address_phone_number: null,
121
-	                'address_group' =>    isset($params->address_group) ? $params->address_group: null,
122
-	                'first_name' =>    isset($params->first_name) ? $params->first_name: null,
123
-	                'last_name' =>    isset($params->last_name) ? $params->last_name: null,
124
-                    'local_time_window_start' =>    isset($params->local_time_window_start) ? $params->local_time_window_start: null,
125
-                    'local_time_window_end' =>    isset($params->local_time_window_end) ? $params->local_time_window_end: null,
126
-                    'local_time_window_start_2' =>    isset($params->local_time_window_start_2) ? $params->local_time_window_start_2: null,
127
-                    'local_time_window_end_2' =>    isset($params->local_time_window_end_2) ? $params->local_time_window_end_2: null,
128
-	                'address_email' =>    isset($params->address_email) ? $params->address_email: null,
129
-	                'address_city' =>    isset($params->address_city) ? $params->address_city: null,
130
-	                'address_state_id' =>    isset($params->address_state_id) ? $params->address_state_id: null,
131
-	                'address_country_id' =>    isset($params->address_country_id) ? $params->address_country_id: null,
132
-	                'address_zip' =>    isset($params->address_zip) ? $params->address_zip: null,
133
-	                'address_custom_data' =>    isset($params->address_custom_data) ? $params->address_custom_data: null,
134
-	                'schedule' =>    isset($params->schedule) ? $params->schedule: null,
135
-	                'schedule_blacklist' =>    isset($params->schedule_blacklist) ? $params->schedule_blacklist: null,
136
-	                'service_time' =>    isset($params->service_time) ? $params->service_time: null,
137
-	                'local_timezone_string' =>    isset($params->local_timezone_string) ? $params->local_timezone_string: null,
138
-	                'color' =>    isset($params->color) ? $params->color: null,
139
-	                'address_icon' =>    isset($params->address_icon) ? $params->address_icon: null,
140
-	                'address_stop_type' =>    isset($params->address_stop_type) ? $params->address_stop_type: null,
141
-	                'address_cube' =>    isset($params->address_cube) ? $params->address_cube: null,
142
-	                'address_pieces' =>    isset($params->address_pieces) ? $params->address_pieces: null,
143
-	                'address_reference_no' =>    isset($params->address_reference_no) ? $params->address_reference_no: null,
144
-	                'address_revenue' =>    isset($params->address_revenue) ? $params->address_revenue: null,
145
-	                'address_weight' =>    isset($params->address_weight) ? $params->address_weight: null,
146
-	                'address_priority' =>    isset($params->address_priority) ? $params->address_priority: null,
147
-	                'address_customer_po' =>    isset($params->address_customer_po) ? $params->address_customer_po: null,
148
-	            )
149
-	        ));
107
+		{
108
+			$ablocations = Route4Me::makeRequst(array(
109
+				'url'    => self::$apiUrl,
110
+				'method' => 'POST',
111
+				'body'  => array(
112
+					'address_1' => 	isset($params->address_1) ? $params->address_1: null,
113
+					'address_2' =>    isset($params->address_2) ? $params->address_2: null,
114
+					'address_alias' =>    isset($params->address_alias) ? $params->address_alias: null,
115
+					'first_name' => isset($params->first_name) ? $params->first_name : null,
116
+					'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
117
+					'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
118
+					'curbside_lat' => isset($params->curbside_lat) ? $params->curbside_lat : null,
119
+					'curbside_lng' => isset($params->curbside_lng) ? $params->curbside_lng : null,
120
+					'address_phone_number' =>    isset($params->address_phone_number) ? $params->address_phone_number: null,
121
+					'address_group' =>    isset($params->address_group) ? $params->address_group: null,
122
+					'first_name' =>    isset($params->first_name) ? $params->first_name: null,
123
+					'last_name' =>    isset($params->last_name) ? $params->last_name: null,
124
+					'local_time_window_start' =>    isset($params->local_time_window_start) ? $params->local_time_window_start: null,
125
+					'local_time_window_end' =>    isset($params->local_time_window_end) ? $params->local_time_window_end: null,
126
+					'local_time_window_start_2' =>    isset($params->local_time_window_start_2) ? $params->local_time_window_start_2: null,
127
+					'local_time_window_end_2' =>    isset($params->local_time_window_end_2) ? $params->local_time_window_end_2: null,
128
+					'address_email' =>    isset($params->address_email) ? $params->address_email: null,
129
+					'address_city' =>    isset($params->address_city) ? $params->address_city: null,
130
+					'address_state_id' =>    isset($params->address_state_id) ? $params->address_state_id: null,
131
+					'address_country_id' =>    isset($params->address_country_id) ? $params->address_country_id: null,
132
+					'address_zip' =>    isset($params->address_zip) ? $params->address_zip: null,
133
+					'address_custom_data' =>    isset($params->address_custom_data) ? $params->address_custom_data: null,
134
+					'schedule' =>    isset($params->schedule) ? $params->schedule: null,
135
+					'schedule_blacklist' =>    isset($params->schedule_blacklist) ? $params->schedule_blacklist: null,
136
+					'service_time' =>    isset($params->service_time) ? $params->service_time: null,
137
+					'local_timezone_string' =>    isset($params->local_timezone_string) ? $params->local_timezone_string: null,
138
+					'color' =>    isset($params->color) ? $params->color: null,
139
+					'address_icon' =>    isset($params->address_icon) ? $params->address_icon: null,
140
+					'address_stop_type' =>    isset($params->address_stop_type) ? $params->address_stop_type: null,
141
+					'address_cube' =>    isset($params->address_cube) ? $params->address_cube: null,
142
+					'address_pieces' =>    isset($params->address_pieces) ? $params->address_pieces: null,
143
+					'address_reference_no' =>    isset($params->address_reference_no) ? $params->address_reference_no: null,
144
+					'address_revenue' =>    isset($params->address_revenue) ? $params->address_revenue: null,
145
+					'address_weight' =>    isset($params->address_weight) ? $params->address_weight: null,
146
+					'address_priority' =>    isset($params->address_priority) ? $params->address_priority: null,
147
+					'address_customer_po' =>    isset($params->address_customer_po) ? $params->address_customer_po: null,
148
+				)
149
+			));
150 150
 
151 151
 			return $ablocations;
152 152
 		}
153 153
 		
154 154
 		public function deleteAdressBookLocation($address_ids)
155
-	    {
156
-	        $address = Route4Me::makeRequst(array(
157
-	            'url'    => self::$apiUrl,
158
-	            'method' => 'DELETEARRAY',
159
-	            'query'  => array(
160
-	                'address_ids'     => $address_ids
161
-	            )
162
-	        ));
155
+		{
156
+			$address = Route4Me::makeRequst(array(
157
+				'url'    => self::$apiUrl,
158
+				'method' => 'DELETEARRAY',
159
+				'query'  => array(
160
+					'address_ids'     => $address_ids
161
+				)
162
+			));
163 163
 	
164
-	        return $address;
165
-	    }
164
+			return $address;
165
+		}
166 166
 		
167 167
 		public function updateAdressBookLocation($params)
168
-	    {
169
-	    	//echo "address_id --> ".$params["address_id"]."<br";
170
-	        $address = Route4Me::makeRequst(array(
171
-	            'url'    => self::$apiUrl,
172
-	            'method' => 'PUT',
173
-	            'query'   => $params,
168
+		{
169
+			//echo "address_id --> ".$params["address_id"]."<br";
170
+			$address = Route4Me::makeRequst(array(
171
+				'url'    => self::$apiUrl,
172
+				'method' => 'PUT',
173
+				'query'   => $params,
174 174
 
175
-	        ));
175
+			));
176 176
 	
177
-	        return $address;
178
-	    }
177
+			return $address;
178
+		}
179 179
 			
180 180
 		public static function get($params)
181
-	    {
182
-	    	$ablocations = Route4Me::makeRequst(array(
183
-	            'url'    => self::$apiUrl,
184
-	            'method' => 'ADD',
185
-	            'query'  => array(
186
-	                'first_name' => isset($params->first_name) ? $params->first_name : null,
187
-	                'address_1' => isset($params->address_1) ? $params->address_1: null,
188
-	                'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
189
-	                'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
190
-	            )
191
-	        ));
181
+		{
182
+			$ablocations = Route4Me::makeRequst(array(
183
+				'url'    => self::$apiUrl,
184
+				'method' => 'ADD',
185
+				'query'  => array(
186
+					'first_name' => isset($params->first_name) ? $params->first_name : null,
187
+					'address_1' => isset($params->address_1) ? $params->address_1: null,
188
+					'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
189
+					'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
190
+				)
191
+			));
192 192
 
193 193
 			return $ablocations;
194 194
 		}
195 195
         
196
-        public static function validateScheduleMode($scheduleMode)
197
-        {
198
-            $schedMmodes=array("daily","weekly","monthly","annually");
196
+		public static function validateScheduleMode($scheduleMode)
197
+		{
198
+			$schedMmodes=array("daily","weekly","monthly","annually");
199 199
             
200
-            if (in_array($scheduleMode, $schedMmodes)) return TRUE; else return FALSE;
201
-        }
200
+			if (in_array($scheduleMode, $schedMmodes)) return TRUE; else return FALSE;
201
+		}
202 202
         
203
-        public static function validateScheduleEnable($scheduleEnabled)
204
-        {
205
-            $schedEnambles=array(TRUE,FALSE);
203
+		public static function validateScheduleEnable($scheduleEnabled)
204
+		{
205
+			$schedEnambles=array(TRUE,FALSE);
206 206
             
207
-            if (in_array($scheduleEnabled, $schedEnambles)) return TRUE; else return FALSE;
208
-        }
207
+			if (in_array($scheduleEnabled, $schedEnambles)) return TRUE; else return FALSE;
208
+		}
209 209
         
210
-        public static function validateScheduleEvery($scheduleEvery)
211
-        {
212
-            if (is_numeric($scheduleEvery)) return TRUE; else return FALSE;
213
-        }
210
+		public static function validateScheduleEvery($scheduleEvery)
211
+		{
212
+			if (is_numeric($scheduleEvery)) return TRUE; else return FALSE;
213
+		}
214 214
         
215
-        public static function validateScheduleWeekDays($scheduleWeekDays)
216
-        {
217
-            $weekdays = explode(',', $scheduleWeekDays);
215
+		public static function validateScheduleWeekDays($scheduleWeekDays)
216
+		{
217
+			$weekdays = explode(',', $scheduleWeekDays);
218 218
             
219
-            if (sizeof($weekdays)<1) return FALSE;
219
+			if (sizeof($weekdays)<1) return FALSE;
220 220
             
221
-            $isValid=TRUE;
221
+			$isValid=TRUE;
222 222
             
223
-            for ($i=0; $i < sizeof($weekdays); $i++) { 
224
-                if (is_numeric($weekdays[$i])) {
225
-                    $wday=intval($weekdays[$i]);
226
-                    if ($wday<1 || $wday>7) $isValid=FALSE;
227
-                }
228
-                else $isValid=FALSE;
229
-            }
230
-            //echo $scheduleWeekDays.' --- '. $isValid."<br>";
231
-            return $isValid;
232
-        }
223
+			for ($i=0; $i < sizeof($weekdays); $i++) { 
224
+				if (is_numeric($weekdays[$i])) {
225
+					$wday=intval($weekdays[$i]);
226
+					if ($wday<1 || $wday>7) $isValid=FALSE;
227
+				}
228
+				else $isValid=FALSE;
229
+			}
230
+			//echo $scheduleWeekDays.' --- '. $isValid."<br>";
231
+			return $isValid;
232
+		}
233 233
         
234
-        public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
235
-        {
236
-            $schedMonthlyMmodes=array("dates","nth");
234
+		public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
235
+		{
236
+			$schedMonthlyMmodes=array("dates","nth");
237 237
             
238
-            if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) return TRUE; else return FALSE;
239
-        }
238
+			if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) return TRUE; else return FALSE;
239
+		}
240 240
         
241
-        public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
242
-        {
243
-            $monthlyDates = explode(',', $scheduleMonthlyDates);
241
+		public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
242
+		{
243
+			$monthlyDates = explode(',', $scheduleMonthlyDates);
244 244
             
245
-            if (sizeof($monthlyDates)<1) return FALSE;
245
+			if (sizeof($monthlyDates)<1) return FALSE;
246 246
             
247
-            $isValid=TRUE;
247
+			$isValid=TRUE;
248 248
             
249
-            for ($i=0; $i < sizeof($monthlyDates); $i++) { 
250
-                if (is_numeric($monthlyDates[$i])) {
251
-                    $mday=intval($monthlyDates[$i]);
252
-                    if ($mday<1 || $mday>31) $isValid=FALSE;
253
-                }
254
-                else $isValid=FALSE;
255
-            }
256
-            //echo $scheduleMonthlyDates.' --- '. $isValid."<br>";
257
-            return $isValid;
258
-        }
249
+			for ($i=0; $i < sizeof($monthlyDates); $i++) { 
250
+				if (is_numeric($monthlyDates[$i])) {
251
+					$mday=intval($monthlyDates[$i]);
252
+					if ($mday<1 || $mday>31) $isValid=FALSE;
253
+				}
254
+				else $isValid=FALSE;
255
+			}
256
+			//echo $scheduleMonthlyDates.' --- '. $isValid."<br>";
257
+			return $isValid;
258
+		}
259 259
         
260
-        public static function validateScheduleNthN($scheduleNthN)
261
-        {
262
-            if (!is_numeric($scheduleNthN)) return FALSE;
260
+		public static function validateScheduleNthN($scheduleNthN)
261
+		{
262
+			if (!is_numeric($scheduleNthN)) return FALSE;
263 263
             
264
-            $schedNthNs=array(1,2,3,4,5,-1);
265
-            if (in_array($scheduleNthN, $schedNthNs)) return TRUE; else return FALSE;
266
-        }
264
+			$schedNthNs=array(1,2,3,4,5,-1);
265
+			if (in_array($scheduleNthN, $schedNthNs)) return TRUE; else return FALSE;
266
+		}
267 267
         
268
-        public static function validateScheduleNthWhat($scheduleNthWhat)
269
-        {
270
-            if (!is_numeric($scheduleNthWhat)) return FALSE;
268
+		public static function validateScheduleNthWhat($scheduleNthWhat)
269
+		{
270
+			if (!is_numeric($scheduleNthWhat)) return FALSE;
271 271
             
272
-            $schedNthWhats=array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
273
-            if (in_array($scheduleNthWhat, $schedNthWhats)) return TRUE; else return FALSE;
274
-        }
272
+			$schedNthWhats=array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
273
+			if (in_array($scheduleNthWhat, $schedNthWhats)) return TRUE; else return FALSE;
274
+		}
275 275
 	}
276 276
 	
277 277
 ?>
Please login to merge, or discard this patch.
examples/Optimizations/hybridOptimization.php 1 patch
Indentation   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -25,222 +25,222 @@
 block discarded – undo
25 25
 /* Add Address Book Locations with schedules */
26 26
 
27 27
 if (($handle = fopen("$source_file", "r")) !== FALSE) {
28
-        $columns = fgetcsv($handle, $max_line_length, $delemietr);
29
-        if (!$columns) {
30
-            $error['message'] = 'Empty';
31
-             return ($error);
32
-        }
28
+		$columns = fgetcsv($handle, $max_line_length, $delemietr);
29
+		if (!$columns) {
30
+			$error['message'] = 'Empty';
31
+			 return ($error);
32
+		}
33 33
         
34
-        $iRow=1;
34
+		$iRow=1;
35 35
         
36
-        while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) {
37
-            //if ($iRow==1) {$iRow++; continue;}
36
+		while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) {
37
+			//if ($iRow==1) {$iRow++; continue;}
38 38
             
39
-            if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) { // ignore blank lines
40
-                    //$data1 = $rows[0].", ".$rows[1].", ".$rows[3];
41
-                    
42
-                    $schedule="";
43
-                    $mode="";
44
-                    
45
-                    if (isset($rows[8])) {
46
-                        if (AddressBookLocation::validateScheduleMode($rows[8])) {
47
-                            $schedule='"mode":"'.$rows[8].'",'; 
48
-                            $mode=$rows[8];
49
-                        }
50
-                        else {echo "$iRow --> Wrong schedule mode parameter <br>"; $schedule="";}
51
-                    }
52
-                    else {echo "$iRow --> The schedule mode parameter is not set <br>"; $schedule="";}
53
-                    
54
-                    if ($schedule=="") {$iRow++; continue;}
55
-                    
56
-                    if (isset($rows[9])) {
57
-                        if (AddressBookLocation::validateScheduleEnable($rows[9])) { 
58
-                            $schedule.='"enabled":'.$rows[9].',';
59
-                        }
60
-                        else {echo "$iRow --> The schedule enabled parameter is not set <br>"; $schedule="";}
61
-                    }
62
-                    
63
-                    if ($schedule=="") {$iRow++; continue;}
64
-                    
65
-                    if (isset($rows[10])) {
66
-                        if (AddressBookLocation::validateScheduleEvery($rows[10])) {
67
-                            $schedule.='"'.$mode.'":{'.'"every":'.$rows[10].','; 
68
-                            if ($mode=='daily') {
69
-                                $schedule=trim($schedule,',');
70
-                                $schedule.='}';
71
-                            }
72
-                        }
73
-                        else {echo "$iRow --> The parameter sched_every is not set <br>"; $schedule=""; }
74
-                    }
75
-                    
76
-                    if ($schedule=="") {$iRow++; continue;}
77
-                    
78
-                    if ($mode!='daily') {
79
-                        switch ($mode) {
80
-                            case 'weekly':
81
-                                if (isset($rows[11])) {
82
-                                    if (AddressBookLocation::validateScheduleWeekDays($rows[11])) {
83
-                                         $schedule.='"weekdays":['.$rows[11].']}';
84
-                                    }
85
-                                    else {echo "$iRow --> Wrong weekdays <br>";$schedule="";}
86
-                                }
87
-                                else {echo "$iRow --> The parameters sched_weekdays is not set <br>"; $schedule="";}
88
-                                break;
89
-                            case 'monthly':
90
-                                $monthlyMode="";
91
-                                if (isset($rows[12])) {
92
-                                    if (AddressBookLocation::validateScheduleMonthlyMode($rows[12])) {
93
-                                         $monthlyMode=$rows[12];
94
-                                         $schedule.='"mode": "'.$rows[12].'",';
95
-                                    }
96
-                                    else {echo "$iRow --> Wrong monthly mode <br>"; $schedule="";}
97
-                                }
98
-                                else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule="";}
39
+			if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) { // ignore blank lines
40
+					//$data1 = $rows[0].", ".$rows[1].", ".$rows[3];
41
+                    
42
+					$schedule="";
43
+					$mode="";
44
+                    
45
+					if (isset($rows[8])) {
46
+						if (AddressBookLocation::validateScheduleMode($rows[8])) {
47
+							$schedule='"mode":"'.$rows[8].'",'; 
48
+							$mode=$rows[8];
49
+						}
50
+						else {echo "$iRow --> Wrong schedule mode parameter <br>"; $schedule="";}
51
+					}
52
+					else {echo "$iRow --> The schedule mode parameter is not set <br>"; $schedule="";}
53
+                    
54
+					if ($schedule=="") {$iRow++; continue;}
55
+                    
56
+					if (isset($rows[9])) {
57
+						if (AddressBookLocation::validateScheduleEnable($rows[9])) { 
58
+							$schedule.='"enabled":'.$rows[9].',';
59
+						}
60
+						else {echo "$iRow --> The schedule enabled parameter is not set <br>"; $schedule="";}
61
+					}
62
+                    
63
+					if ($schedule=="") {$iRow++; continue;}
64
+                    
65
+					if (isset($rows[10])) {
66
+						if (AddressBookLocation::validateScheduleEvery($rows[10])) {
67
+							$schedule.='"'.$mode.'":{'.'"every":'.$rows[10].','; 
68
+							if ($mode=='daily') {
69
+								$schedule=trim($schedule,',');
70
+								$schedule.='}';
71
+							}
72
+						}
73
+						else {echo "$iRow --> The parameter sched_every is not set <br>"; $schedule=""; }
74
+					}
75
+                    
76
+					if ($schedule=="") {$iRow++; continue;}
77
+                    
78
+					if ($mode!='daily') {
79
+						switch ($mode) {
80
+							case 'weekly':
81
+								if (isset($rows[11])) {
82
+									if (AddressBookLocation::validateScheduleWeekDays($rows[11])) {
83
+										 $schedule.='"weekdays":['.$rows[11].']}';
84
+									}
85
+									else {echo "$iRow --> Wrong weekdays <br>";$schedule="";}
86
+								}
87
+								else {echo "$iRow --> The parameters sched_weekdays is not set <br>"; $schedule="";}
88
+								break;
89
+							case 'monthly':
90
+								$monthlyMode="";
91
+								if (isset($rows[12])) {
92
+									if (AddressBookLocation::validateScheduleMonthlyMode($rows[12])) {
93
+										 $monthlyMode=$rows[12];
94
+										 $schedule.='"mode": "'.$rows[12].'",';
95
+									}
96
+									else {echo "$iRow --> Wrong monthly mode <br>"; $schedule="";}
97
+								}
98
+								else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule="";}
99 99
                                 
100
-                                if ($monthlyMode!="") {
101
-                                    switch ($monthlyMode) {
102
-                                        case 'dates':
103
-                                            if (isset($rows[13])) {
104
-                                                if (AddressBookLocation::validateScheduleMonthlyDates($rows[13])) {
105
-                                                     $schedule.='"dates":['.$rows[13].']}';
106
-                                                }
107
-                                                else {echo "$iRow --> Wrong monthly dates <br>"; $schedule="";}
108
-                                            }
109
-                                            break;
110
-                                        case 'nth':
111
-                                            if (isset($rows[16])) {
112
-                                                if (AddressBookLocation::validateScheduleNthN($rows[16])) {
113
-                                                     $schedule.='"nth":{"n":'.$rows[16].',';
114
-                                                }
115
-                                                else {echo "$iRow --> Wrong parameter sched_nth_n <br>"; $schedule="";}
116
-                                            }
117
-                                            else {echo "$iRow --> The parameter sched_nth_n is not set <br>"; $schedule="";}
100
+								if ($monthlyMode!="") {
101
+									switch ($monthlyMode) {
102
+										case 'dates':
103
+											if (isset($rows[13])) {
104
+												if (AddressBookLocation::validateScheduleMonthlyDates($rows[13])) {
105
+													 $schedule.='"dates":['.$rows[13].']}';
106
+												}
107
+												else {echo "$iRow --> Wrong monthly dates <br>"; $schedule="";}
108
+											}
109
+											break;
110
+										case 'nth':
111
+											if (isset($rows[16])) {
112
+												if (AddressBookLocation::validateScheduleNthN($rows[16])) {
113
+													 $schedule.='"nth":{"n":'.$rows[16].',';
114
+												}
115
+												else {echo "$iRow --> Wrong parameter sched_nth_n <br>"; $schedule="";}
116
+											}
117
+											else {echo "$iRow --> The parameter sched_nth_n is not set <br>"; $schedule="";}
118 118
                                             
119
-                                            if ($schedule!="") {
120
-                                                if (isset($rows[17])) {
121
-                                                    if (AddressBookLocation::validateScheduleNthWhat($rows[17])) {
122
-                                                         $schedule.='"what":'.$rows[17].'}}';
123
-                                                    }
124
-                                                    else {echo "$iRow --> Wrong parameter sched_nth_what <br>"; $schedule="";}
125
-                                                }
126
-                                                else {echo "$iRow --> The parameter sched_nth_what is not set <br>"; $schedule="";}
127
-                                            }
119
+											if ($schedule!="") {
120
+												if (isset($rows[17])) {
121
+													if (AddressBookLocation::validateScheduleNthWhat($rows[17])) {
122
+														 $schedule.='"what":'.$rows[17].'}}';
123
+													}
124
+													else {echo "$iRow --> Wrong parameter sched_nth_what <br>"; $schedule="";}
125
+												}
126
+												else {echo "$iRow --> The parameter sched_nth_what is not set <br>"; $schedule="";}
127
+											}
128 128
                                             
129
-                                            break;
130
-                                    }
131
-                                }
132
-                                break;
133
-                            default:
134
-                                $schedule=="";
135
-                                break;
136
-                        }
129
+											break;
130
+									}
131
+								}
132
+								break;
133
+							default:
134
+								$schedule=="";
135
+								break;
136
+						}
137 137
                         
138
-                    }
138
+					}
139 139
                     
140
-                    if ($schedule=="") {$iRow++; continue;}
140
+					if ($schedule=="") {$iRow++; continue;}
141 141
                     
142
-                    $schedule=strtolower($schedule);
142
+					$schedule=strtolower($schedule);
143 143
                     
144
-                    $schedule='[{'.$schedule.'}]';
144
+					$schedule='[{'.$schedule.'}]';
145 145
 
146
-                    //echo "$iRow --> ".$schedule."<br>";
147
-                    $oSchedule= json_decode($schedule,TRUE);
148
-                    
149
-                    //echo "<br>"; var_dump($oSchedule); echo "<br>";
150
-                    
151
-                    $AdressBookLocationParameters=AddressBookLocation::fromArray(array(
152
-                        "cached_lat"    => $rows[0],
153
-                        "cached_lng"    => $rows[1],
154
-                        "address_alias"     => $rows[2],
155
-                        "address_1"     => $rows[3],
156
-                        "address_city"     => isset($rows[4]) ? $rows[4] : null,
157
-                        "address_state_id"     => isset($rows[5]) ? $rows[5] : null,
158
-                        "address_zip"     => isset($rows[6]) ? "$rows[6]" : null,
159
-                        "address_phone_number"  => isset($rows[7]) ? $rows[7] : null,
160
-                        "schedule" => isset($oSchedule) ? $oSchedule : null,
161
-                    ));
162
-                    
163
-                    $abContacts=new AddressBookLocation();
146
+					//echo "$iRow --> ".$schedule."<br>";
147
+					$oSchedule= json_decode($schedule,TRUE);
148
+                    
149
+					//echo "<br>"; var_dump($oSchedule); echo "<br>";
150
+                    
151
+					$AdressBookLocationParameters=AddressBookLocation::fromArray(array(
152
+						"cached_lat"    => $rows[0],
153
+						"cached_lng"    => $rows[1],
154
+						"address_alias"     => $rows[2],
155
+						"address_1"     => $rows[3],
156
+						"address_city"     => isset($rows[4]) ? $rows[4] : null,
157
+						"address_state_id"     => isset($rows[5]) ? $rows[5] : null,
158
+						"address_zip"     => isset($rows[6]) ? "$rows[6]" : null,
159
+						"address_phone_number"  => isset($rows[7]) ? $rows[7] : null,
160
+						"schedule" => isset($oSchedule) ? $oSchedule : null,
161
+					));
162
+                    
163
+					$abContacts=new AddressBookLocation();
164 164
     
165
-                    $abcResults=$abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
166
-                    
167
-                    echo "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly <br>"; //temporarry
168
-              }
169
-              else echo "$iRow --> Wrong Address or latitude or longitude <br>";
170
-              $iRow++;
171
-            }
172
-    }
165
+					$abcResults=$abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
166
+                    
167
+					echo "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly <br>"; //temporarry
168
+			  }
169
+			  else echo "$iRow --> Wrong Address or latitude or longitude <br>";
170
+			  $iRow++;
171
+			}
172
+	}
173 173
 
174 174
 /* Get Hybrid Optimization */
175 175
 
176
-    $ep = time()+604800;
177
-    $sched_date = date("Y-m-d", $ep);
176
+	$ep = time()+604800;
177
+	$sched_date = date("Y-m-d", $ep);
178 178
 
179
-    $hybridParams = array(
180
-        "target_date_string" => $sched_date,
181
-        "timezone_offset_minutes" => 480
182
-    );
179
+	$hybridParams = array(
180
+		"target_date_string" => $sched_date,
181
+		"timezone_offset_minutes" => 480
182
+	);
183 183
     
184
-    $optimization = new OptimizationProblem(); 
185
-    $hybridOptimization = $optimization->getHybridOptimization($hybridParams);
184
+	$optimization = new OptimizationProblem(); 
185
+	$hybridOptimization = $optimization->getHybridOptimization($hybridParams);
186 186
     
187
-    if ($hybridOptimization!=null) {
187
+	if ($hybridOptimization!=null) {
188 188
         
189
-        if (isset($hybridOptimization['optimization_problem_id'])) {
190
-            $optid = $hybridOptimization['optimization_problem_id'];
189
+		if (isset($hybridOptimization['optimization_problem_id'])) {
190
+			$optid = $hybridOptimization['optimization_problem_id'];
191 191
             
192
-            echo "Hibrid optimization with optimization_problem_id=$optid <br><br>";
192
+			echo "Hibrid optimization with optimization_problem_id=$optid <br><br>";
193 193
             
194
-            /* Add depots to the Hybrid Optimization */
195
-            $depotfile = "depots.csv";
194
+			/* Add depots to the Hybrid Optimization */
195
+			$depotfile = "depots.csv";
196 196
             
197
-            if (($handle = fopen("$depotfile", "r")) !== FALSE) {
197
+			if (($handle = fopen("$depotfile", "r")) !== FALSE) {
198 198
                 
199
-                $columns = fgetcsv($handle, $max_line_length, $delemietr);
199
+				$columns = fgetcsv($handle, $max_line_length, $delemietr);
200 200
                 
201
-                if (!$columns) {
202
-                    $error['message'] = 'Empty';
203
-                     return ($error);
204
-                }
201
+				if (!$columns) {
202
+					$error['message'] = 'Empty';
203
+					 return ($error);
204
+				}
205 205
                 
206
-                $depotsParams = array(
207
-                    'optimization_problem_id' => $optid,
208
-                    'delete_old_depots'  => true,
209
-                );
206
+				$depotsParams = array(
207
+					'optimization_problem_id' => $optid,
208
+					'delete_old_depots'  => true,
209
+				);
210 210
                 
211
-                $iRow=1;
212
-                $depotAddresses = array();
211
+				$iRow=1;
212
+				$depotAddresses = array();
213 213
                 
214
-                while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) {
215
-                    if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) {
216
-                        $depotAddress['lat']= $rows[0];
217
-                        $depotAddress['lng']= $rows[1];
218
-                        $depotAddress['address']= $rows[3];   
219
-                        array_push($depotAddresses,$depotAddress);
220
-                    }
221
-                }
214
+				while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) {
215
+					if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) {
216
+						$depotAddress['lat']= $rows[0];
217
+						$depotAddress['lng']= $rows[1];
218
+						$depotAddress['address']= $rows[3];   
219
+						array_push($depotAddresses,$depotAddress);
220
+					}
221
+				}
222 222
                 
223
-                $depotsParams['new_depots'] = $depotAddresses;
223
+				$depotsParams['new_depots'] = $depotAddresses;
224 224
                 
225
-                $optProblem = new OptimizationProblem();
225
+				$optProblem = new OptimizationProblem();
226 226
                 
227
-                $resultDepots = $optProblem->addDepotsToHybrid($depotsParams);
227
+				$resultDepots = $optProblem->addDepotsToHybrid($depotsParams);
228 228
                 
229
-                var_dump($resultDepots);
229
+				var_dump($resultDepots);
230 230
                 
231
-                /* Reoptimize hybrid optimization */
231
+				/* Reoptimize hybrid optimization */
232 232
                 
233
-                if ($resultDepots!=null) {
234
-                    $problemParams = array(
235
-                        'optimization_problem_id'  =>  $optid
236
-                    );
237
-                    $problem = OptimizationProblem::reoptimize($problemParams);
238
-                    
239
-                    Route4Me::simplePrint($problem);
240
-                }
241
-            }
233
+				if ($resultDepots!=null) {
234
+					$problemParams = array(
235
+						'optimization_problem_id'  =>  $optid
236
+					);
237
+					$problem = OptimizationProblem::reoptimize($problemParams);
238
+                    
239
+					Route4Me::simplePrint($problem);
240
+				}
241
+			}
242 242
                 
243
-        }
243
+		}
244 244
 
245
-    }
245
+	}
246 246
 ?>
247 247
\ No newline at end of file
Please login to merge, or discard this patch.