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
examples/Optimizations/hybridOptimization.php 5 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,6 @@
 block discarded – undo
6 6
 require $vdir.'/../vendor/autoload.php';
7 7
 
8 8
 use Route4Me\OptimizationProblem;
9
-use Route4Me\Route;
10 9
 use Route4Me\Route4Me;
11 10
 
12 11
 /* The example demonstrates process of creating a Hybrid Optimization using scheduling addresses and orders.
Please login to merge, or discard this 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.
Switch Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -77,62 +77,62 @@
 block discarded – undo
77 77
                     
78 78
                     if ($mode!='daily') {
79 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="";}
80
+                        case 'weekly':
81
+                            if (isset($rows[11])) {
82
+                                if (AddressBookLocation::validateScheduleWeekDays($rows[11])) {
83
+                                     $schedule.='"weekdays":['.$rows[11].']}';
86 84
                                 }
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="";}
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].'",';
97 95
                                 }
98
-                                else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule="";}
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="";}
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
-                                            }
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="";}
128 118
                                             
129
-                                            break;
119
+                                if ($schedule!="") {
120
+                                if (isset($rows[17])) {
121
+                                    if (AddressBookLocation::validateScheduleNthWhat($rows[17])) {
122
+                                         $schedule.='"what":'.$rows[17].'}}';
130 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="";}
131 127
                                 }
128
+                                            
132 129
                                 break;
133
-                            default:
134
-                                $schedule=="";
130
+                                }
131
+                                }
135 132
                                 break;
133
+                        default:
134
+                            $schedule=="";
135
+                            break;
136 136
                         }
137 137
                         
138 138
                     }
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Route4Me;
3 3
 
4
-$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
4
+$vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
5 5
 
6 6
 require $vdir.'/../vendor/autoload.php';
7 7
 
@@ -17,113 +17,113 @@  discard block
 block discarded – undo
17 17
 
18 18
 Route4Me::setApiKey('11111111111111111111111111111111');
19 19
 
20
-$source_file="addresses_1000.csv";
20
+$source_file = "addresses_1000.csv";
21 21
 $max_line_length = 512;
22
-$delemietr=',';
22
+$delemietr = ',';
23 23
 
24 24
 
25 25
 /* Add Address Book Locations with schedules */
26 26
 
27
-if (($handle = fopen("$source_file", "r")) !== FALSE) {
27
+if (($handle = fopen("$source_file", "r"))!==FALSE) {
28 28
         $columns = fgetcsv($handle, $max_line_length, $delemietr);
29 29
         if (!$columns) {
30 30
             $error['message'] = 'Empty';
31 31
              return ($error);
32 32
         }
33 33
         
34
-        $iRow=1;
34
+        $iRow = 1;
35 35
         
36
-        while (($rows = fgetcsv($handle, $max_line_length, $delemietr)) !== false) {
36
+        while (($rows = fgetcsv($handle, $max_line_length, $delemietr))!==false) {
37 37
             //if ($iRow==1) {$iRow++; continue;}
38 38
             
39
-            if ($rows[0] && $rows[1] && $rows[3] && array(null) !== $rows) { // ignore blank lines
39
+            if ($rows[0] && $rows[1] && $rows[3] && array(null)!==$rows) { // ignore blank lines
40 40
                     //$data1 = $rows[0].", ".$rows[1].", ".$rows[3];
41 41
                     
42
-                    $schedule="";
43
-                    $mode="";
42
+                    $schedule = "";
43
+                    $mode = "";
44 44
                     
45 45
                     if (isset($rows[8])) {
46 46
                         if (AddressBookLocation::validateScheduleMode($rows[8])) {
47
-                            $schedule='"mode":"'.$rows[8].'",'; 
48
-                            $mode=$rows[8];
47
+                            $schedule = '"mode":"'.$rows[8].'",'; 
48
+                            $mode = $rows[8];
49 49
                         }
50
-                        else {echo "$iRow --> Wrong schedule mode parameter <br>"; $schedule="";}
50
+                        else {echo "$iRow --> Wrong schedule mode parameter <br>"; $schedule = ""; }
51 51
                     }
52
-                    else {echo "$iRow --> The schedule mode parameter is not set <br>"; $schedule="";}
52
+                    else {echo "$iRow --> The schedule mode parameter is not set <br>"; $schedule = ""; }
53 53
                     
54
-                    if ($schedule=="") {$iRow++; continue;}
54
+                    if ($schedule=="") {$iRow++; continue; }
55 55
                     
56 56
                     if (isset($rows[9])) {
57 57
                         if (AddressBookLocation::validateScheduleEnable($rows[9])) { 
58
-                            $schedule.='"enabled":'.$rows[9].',';
58
+                            $schedule .= '"enabled":'.$rows[9].',';
59 59
                         }
60
-                        else {echo "$iRow --> The schedule enabled parameter is not set <br>"; $schedule="";}
60
+                        else {echo "$iRow --> The schedule enabled parameter is not set <br>"; $schedule = ""; }
61 61
                     }
62 62
                     
63
-                    if ($schedule=="") {$iRow++; continue;}
63
+                    if ($schedule=="") {$iRow++; continue; }
64 64
                     
65 65
                     if (isset($rows[10])) {
66 66
                         if (AddressBookLocation::validateScheduleEvery($rows[10])) {
67
-                            $schedule.='"'.$mode.'":{'.'"every":'.$rows[10].','; 
67
+                            $schedule .= '"'.$mode.'":{'.'"every":'.$rows[10].','; 
68 68
                             if ($mode=='daily') {
69
-                                $schedule=trim($schedule,',');
70
-                                $schedule.='}';
69
+                                $schedule = trim($schedule, ',');
70
+                                $schedule .= '}';
71 71
                             }
72 72
                         }
73
-                        else {echo "$iRow --> The parameter sched_every is not set <br>"; $schedule=""; }
73
+                        else {echo "$iRow --> The parameter sched_every is not set <br>"; $schedule = ""; }
74 74
                     }
75 75
                     
76
-                    if ($schedule=="") {$iRow++; continue;}
76
+                    if ($schedule=="") {$iRow++; continue; }
77 77
                     
78 78
                     if ($mode!='daily') {
79 79
                         switch ($mode) {
80 80
                             case 'weekly':
81 81
                                 if (isset($rows[11])) {
82 82
                                     if (AddressBookLocation::validateScheduleWeekDays($rows[11])) {
83
-                                         $schedule.='"weekdays":['.$rows[11].']}';
83
+                                         $schedule .= '"weekdays":['.$rows[11].']}';
84 84
                                     }
85
-                                    else {echo "$iRow --> Wrong weekdays <br>";$schedule="";}
85
+                                    else {echo "$iRow --> Wrong weekdays <br>"; $schedule = ""; }
86 86
                                 }
87
-                                else {echo "$iRow --> The parameters sched_weekdays is not set <br>"; $schedule="";}
87
+                                else {echo "$iRow --> The parameters sched_weekdays is not set <br>"; $schedule = ""; }
88 88
                                 break;
89 89
                             case 'monthly':
90
-                                $monthlyMode="";
90
+                                $monthlyMode = "";
91 91
                                 if (isset($rows[12])) {
92 92
                                     if (AddressBookLocation::validateScheduleMonthlyMode($rows[12])) {
93
-                                         $monthlyMode=$rows[12];
94
-                                         $schedule.='"mode": "'.$rows[12].'",';
93
+                                         $monthlyMode = $rows[12];
94
+                                         $schedule .= '"mode": "'.$rows[12].'",';
95 95
                                     }
96
-                                    else {echo "$iRow --> Wrong monthly mode <br>"; $schedule="";}
96
+                                    else {echo "$iRow --> Wrong monthly mode <br>"; $schedule = ""; }
97 97
                                 }
98
-                                else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule="";}
98
+                                else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule = ""; }
99 99
                                 
100 100
                                 if ($monthlyMode!="") {
101 101
                                     switch ($monthlyMode) {
102 102
                                         case 'dates':
103 103
                                             if (isset($rows[13])) {
104 104
                                                 if (AddressBookLocation::validateScheduleMonthlyDates($rows[13])) {
105
-                                                     $schedule.='"dates":['.$rows[13].']}';
105
+                                                     $schedule .= '"dates":['.$rows[13].']}';
106 106
                                                 }
107
-                                                else {echo "$iRow --> Wrong monthly dates <br>"; $schedule="";}
107
+                                                else {echo "$iRow --> Wrong monthly dates <br>"; $schedule = ""; }
108 108
                                             }
109 109
                                             break;
110 110
                                         case 'nth':
111 111
                                             if (isset($rows[16])) {
112 112
                                                 if (AddressBookLocation::validateScheduleNthN($rows[16])) {
113
-                                                     $schedule.='"nth":{"n":'.$rows[16].',';
113
+                                                     $schedule .= '"nth":{"n":'.$rows[16].',';
114 114
                                                 }
115
-                                                else {echo "$iRow --> Wrong parameter sched_nth_n <br>"; $schedule="";}
115
+                                                else {echo "$iRow --> Wrong parameter sched_nth_n <br>"; $schedule = ""; }
116 116
                                             }
117
-                                            else {echo "$iRow --> The parameter sched_nth_n is not set <br>"; $schedule="";}
117
+                                            else {echo "$iRow --> The parameter sched_nth_n is not set <br>"; $schedule = ""; }
118 118
                                             
119 119
                                             if ($schedule!="") {
120 120
                                                 if (isset($rows[17])) {
121 121
                                                     if (AddressBookLocation::validateScheduleNthWhat($rows[17])) {
122
-                                                         $schedule.='"what":'.$rows[17].'}}';
122
+                                                         $schedule .= '"what":'.$rows[17].'}}';
123 123
                                                     }
124
-                                                    else {echo "$iRow --> Wrong parameter sched_nth_what <br>"; $schedule="";}
124
+                                                    else {echo "$iRow --> Wrong parameter sched_nth_what <br>"; $schedule = ""; }
125 125
                                                 }
126
-                                                else {echo "$iRow --> The parameter sched_nth_what is not set <br>"; $schedule="";}
126
+                                                else {echo "$iRow --> The parameter sched_nth_what is not set <br>"; $schedule = ""; }
127 127
                                             }
128 128
                                             
129 129
                                             break;
@@ -137,18 +137,18 @@  discard block
 block discarded – undo
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 146
                     //echo "$iRow --> ".$schedule."<br>";
147
-                    $oSchedule= json_decode($schedule,TRUE);
147
+                    $oSchedule = json_decode($schedule, TRUE);
148 148
                     
149 149
                     //echo "<br>"; var_dump($oSchedule); echo "<br>";
150 150
                     
151
-                    $AdressBookLocationParameters=AddressBookLocation::fromArray(array(
151
+                    $AdressBookLocationParameters = AddressBookLocation::fromArray(array(
152 152
                         "cached_lat"    => $rows[0],
153 153
                         "cached_lng"    => $rows[1],
154 154
                         "address_alias"     => $rows[2],
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
                         "schedule" => isset($oSchedule) ? $oSchedule : null,
161 161
                     ));
162 162
                     
163
-                    $abContacts=new AddressBookLocation();
163
+                    $abContacts = new AddressBookLocation();
164 164
     
165
-                    $abcResults=$abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
165
+                    $abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
166 166
                     
167 167
                     echo "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly <br>"; //temporarry
168 168
               }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
 /* Get Hybrid Optimization */
175 175
 
176
-    $ep = time()+604800;
176
+    $ep = time() + 604800;
177 177
     $sched_date = date("Y-m-d", $ep);
178 178
 
179 179
     $hybridParams = array(
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
             /* Add depots to the Hybrid Optimization */
195 195
             $depotfile = "depots.csv";
196 196
             
197
-            if (($handle = fopen("$depotfile", "r")) !== FALSE) {
197
+            if (($handle = fopen("$depotfile", "r"))!==FALSE) {
198 198
                 
199 199
                 $columns = fgetcsv($handle, $max_line_length, $delemietr);
200 200
                 
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
                     'delete_old_depots'  => true,
209 209
                 );
210 210
                 
211
-                $iRow=1;
211
+                $iRow = 1;
212 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);
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 220
                     }
221 221
                 }
222 222
                 
Please login to merge, or discard this patch.
Braces   +15 added lines, -27 removed lines patch added patch discarded remove patch
@@ -46,18 +46,15 @@  discard block
 block discarded – undo
46 46
                         if (AddressBookLocation::validateScheduleMode($rows[8])) {
47 47
                             $schedule='"mode":"'.$rows[8].'",'; 
48 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="";}
49
+                        } else {echo "$iRow --> Wrong schedule mode parameter <br>"; $schedule="";}
50
+                    } else {echo "$iRow --> The schedule mode parameter is not set <br>"; $schedule="";}
53 51
                     
54 52
                     if ($schedule=="") {$iRow++; continue;}
55 53
                     
56 54
                     if (isset($rows[9])) {
57 55
                         if (AddressBookLocation::validateScheduleEnable($rows[9])) { 
58 56
                             $schedule.='"enabled":'.$rows[9].',';
59
-                        }
60
-                        else {echo "$iRow --> The schedule enabled parameter is not set <br>"; $schedule="";}
57
+                        } else {echo "$iRow --> The schedule enabled parameter is not set <br>"; $schedule="";}
61 58
                     }
62 59
                     
63 60
                     if ($schedule=="") {$iRow++; continue;}
@@ -69,8 +66,7 @@  discard block
 block discarded – undo
69 66
                                 $schedule=trim($schedule,',');
70 67
                                 $schedule.='}';
71 68
                             }
72
-                        }
73
-                        else {echo "$iRow --> The parameter sched_every is not set <br>"; $schedule=""; }
69
+                        } else {echo "$iRow --> The parameter sched_every is not set <br>"; $schedule=""; }
74 70
                     }
75 71
                     
76 72
                     if ($schedule=="") {$iRow++; continue;}
@@ -81,10 +77,8 @@  discard block
 block discarded – undo
81 77
                                 if (isset($rows[11])) {
82 78
                                     if (AddressBookLocation::validateScheduleWeekDays($rows[11])) {
83 79
                                          $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="";}
80
+                                    } else {echo "$iRow --> Wrong weekdays <br>";$schedule="";}
81
+                                } else {echo "$iRow --> The parameters sched_weekdays is not set <br>"; $schedule="";}
88 82
                                 break;
89 83
                             case 'monthly':
90 84
                                 $monthlyMode="";
@@ -92,10 +86,8 @@  discard block
 block discarded – undo
92 86
                                     if (AddressBookLocation::validateScheduleMonthlyMode($rows[12])) {
93 87
                                          $monthlyMode=$rows[12];
94 88
                                          $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="";}
89
+                                    } else {echo "$iRow --> Wrong monthly mode <br>"; $schedule="";}
90
+                                } else {echo "$iRow --> The parameter sched_monthly_mode is not set <br>"; $schedule="";}
99 91
                                 
100 92
                                 if ($monthlyMode!="") {
101 93
                                     switch ($monthlyMode) {
@@ -103,27 +95,22 @@  discard block
 block discarded – undo
103 95
                                             if (isset($rows[13])) {
104 96
                                                 if (AddressBookLocation::validateScheduleMonthlyDates($rows[13])) {
105 97
                                                      $schedule.='"dates":['.$rows[13].']}';
106
-                                                }
107
-                                                else {echo "$iRow --> Wrong monthly dates <br>"; $schedule="";}
98
+                                                } else {echo "$iRow --> Wrong monthly dates <br>"; $schedule="";}
108 99
                                             }
109 100
                                             break;
110 101
                                         case 'nth':
111 102
                                             if (isset($rows[16])) {
112 103
                                                 if (AddressBookLocation::validateScheduleNthN($rows[16])) {
113 104
                                                      $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="";}
105
+                                                } else {echo "$iRow --> Wrong parameter sched_nth_n <br>"; $schedule="";}
106
+                                            } else {echo "$iRow --> The parameter sched_nth_n is not set <br>"; $schedule="";}
118 107
                                             
119 108
                                             if ($schedule!="") {
120 109
                                                 if (isset($rows[17])) {
121 110
                                                     if (AddressBookLocation::validateScheduleNthWhat($rows[17])) {
122 111
                                                          $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="";}
112
+                                                    } else {echo "$iRow --> Wrong parameter sched_nth_what <br>"; $schedule="";}
113
+                                                } else {echo "$iRow --> The parameter sched_nth_what is not set <br>"; $schedule="";}
127 114
                                             }
128 115
                                             
129 116
                                             break;
@@ -165,8 +152,9 @@  discard block
 block discarded – undo
165 152
                     $abcResults=$abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
166 153
                     
167 154
                     echo "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly <br>"; //temporarry
155
+              } else {
156
+              	echo "$iRow --> Wrong Address or latitude or longitude <br>";
168 157
               }
169
-              else echo "$iRow --> Wrong Address or latitude or longitude <br>";
170 158
               $iRow++;
171 159
             }
172 160
     }
Please login to merge, or discard this patch.
src/Route4Me/OptimizationProblem.php 2 patches
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.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
             'url'    => self::$apiUrl,
70 70
             'method' => 'POST',
71 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
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 76
             ),
77 77
             'body'   => array(
78 78
                 'addresses'  => $params->getAddressesArray(),
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
         if (isset($optimize['optimizations'])) {
103 103
             $problems = array();
104
-            foreach($optimize['optimizations'] as $problem) {
104
+            foreach ($optimize['optimizations'] as $problem) {
105 105
                 $problems[] = OptimizationProblem::fromArray($problem);
106 106
             }
107 107
             return $problems;
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         return $this->routes;
145 145
     }
146 146
 	
147
-	public function getRandomOptimizationId($offset,$limit)
147
+	public function getRandomOptimizationId($offset, $limit)
148 148
 	{
149 149
 		$query['limit'] = isset($params['limit']) ? $params['limit'] : 30;
150 150
         $query['offset'] = isset($params['offset']) ? $params['offset'] : 0;
@@ -156,16 +156,16 @@  discard block
 block discarded – undo
156 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
-			$num=rand(0,sizeof($optimizations)-1);
166
+			$num = rand(0, sizeof($optimizations) - 1);
167 167
 			//echo "num=$num.<br>".sizeof($optimizations)."<br>";
168
-			$rOptimization=$optimizations[$num];
168
+			$rOptimization = $optimizations[$num];
169 169
 			return $rOptimization;
170 170
 	}
171 171
 	
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	{
174 174
 		if ($opt_id==null) return null;
175 175
 		
176
-		$params = array( "optimization_problem_id" => $opt_id );
176
+		$params = array("optimization_problem_id" => $opt_id);
177 177
 		
178 178
 		$optimization = (array)$this->get($params);
179 179
 		
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
 	{
188 188
 		$addresses = (array)$this->getAddresses($opt_id);
189 189
 		
190
-		if ($addresses == null) {
190
+		if ($addresses==null) {
191 191
 			echo "There are no addresses in this optimization!.. Try again.";
192 192
 			return null;
193 193
 		}
194 194
 		
195
-		$num=rand(0,sizeof($addresses)-1);
196
-		$rAddress=$addresses[$num];
195
+		$num = rand(0, sizeof($addresses) - 1);
196
+		$rAddress = $addresses[$num];
197 197
 		
198 198
 		return $rAddress;
199 199
 	}
Please login to merge, or discard this patch.
src/Route4Me/AddressBookLocation.php 3 patches
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.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 		//public $offset;
33 33
 		//public $limit;
34 34
 		
35
-		public function __construct () {  }
35
+		public function __construct() {  }
36 36
 		
37 37
 		public static function fromArray(array $params) {
38 38
 			$addressbooklocation = new AddressBookLocation();
39
-	        foreach($params as $key => $value) {
39
+	        foreach ($params as $key => $value) {
40 40
 	            if (property_exists($addressbooklocation, $key)) {
41 41
 	                $addressbooklocation->{$key} = $value;
42 42
 	            }
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
 		
62 62
 		public static function searchRoutedLocation($params)
63 63
 	    {
64
-	    	$result= Route4Me::makeRequst(array(
64
+	    	$result = Route4Me::makeRequst(array(
65 65
 	            'url'    => self::$apiUrl,
66 66
 	            'method' => 'GET',
67 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,
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 72
 	                'offset' => isset($params['offset']) ? $params['offset'] : null,
73 73
 	            )
74 74
 	        ));
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	            'url'    => self::$apiUrl,
83 83
 	            'method' => 'GET',
84 84
 	            'query'  => array(
85
-	                'limit' => isset($params->limit) ? $params->limit: null,
85
+	                'limit' => isset($params->limit) ? $params->limit : null,
86 86
 	                'offset' => isset($params->offset) ? $params->offset : null,
87 87
 	            )
88 88
 	        ));
@@ -109,42 +109,42 @@  discard block
 block discarded – undo
109 109
 	            'url'    => self::$apiUrl,
110 110
 	            'method' => 'POST',
111 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,
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 115
 	                'first_name' => isset($params->first_name) ? $params->first_name : null,
116 116
 	                'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
117 117
 	                'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
118 118
 	                'curbside_lat' => isset($params->curbside_lat) ? $params->curbside_lat : null,
119 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,
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 148
 	            )
149 149
 	        ));
150 150
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	            'method' => 'ADD',
185 185
 	            'query'  => array(
186 186
 	                'first_name' => isset($params->first_name) ? $params->first_name : null,
187
-	                'address_1' => isset($params->address_1) ? $params->address_1: null,
187
+	                'address_1' => isset($params->address_1) ? $params->address_1 : null,
188 188
 	                'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
189 189
 	                'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
190 190
 	            )
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
         
196 196
         public static function validateScheduleMode($scheduleMode)
197 197
         {
198
-            $schedMmodes=array("daily","weekly","monthly","annually");
198
+            $schedMmodes = array("daily", "weekly", "monthly", "annually");
199 199
             
200 200
             if (in_array($scheduleMode, $schedMmodes)) return TRUE; else return FALSE;
201 201
         }
202 202
         
203 203
         public static function validateScheduleEnable($scheduleEnabled)
204 204
         {
205
-            $schedEnambles=array(TRUE,FALSE);
205
+            $schedEnambles = array(TRUE, FALSE);
206 206
             
207 207
             if (in_array($scheduleEnabled, $schedEnambles)) return TRUE; else return FALSE;
208 208
         }
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
             
219 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++) { 
223
+            for ($i = 0; $i<sizeof($weekdays); $i++) { 
224 224
                 if (is_numeric($weekdays[$i])) {
225
-                    $wday=intval($weekdays[$i]);
226
-                    if ($wday<1 || $wday>7) $isValid=FALSE;
225
+                    $wday = intval($weekdays[$i]);
226
+                    if ($wday<1 || $wday>7) $isValid = FALSE;
227 227
                 }
228
-                else $isValid=FALSE;
228
+                else $isValid = FALSE;
229 229
             }
230 230
             //echo $scheduleWeekDays.' --- '. $isValid."<br>";
231 231
             return $isValid;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
         
234 234
         public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
235 235
         {
236
-            $schedMonthlyMmodes=array("dates","nth");
236
+            $schedMonthlyMmodes = array("dates", "nth");
237 237
             
238 238
             if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) return TRUE; else return FALSE;
239 239
         }
@@ -244,14 +244,14 @@  discard block
 block discarded – undo
244 244
             
245 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++) { 
249
+            for ($i = 0; $i<sizeof($monthlyDates); $i++) { 
250 250
                 if (is_numeric($monthlyDates[$i])) {
251
-                    $mday=intval($monthlyDates[$i]);
252
-                    if ($mday<1 || $mday>31) $isValid=FALSE;
251
+                    $mday = intval($monthlyDates[$i]);
252
+                    if ($mday<1 || $mday>31) $isValid = FALSE;
253 253
                 }
254
-                else $isValid=FALSE;
254
+                else $isValid = FALSE;
255 255
             }
256 256
             //echo $scheduleMonthlyDates.' --- '. $isValid."<br>";
257 257
             return $isValid;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         {
262 262
             if (!is_numeric($scheduleNthN)) return FALSE;
263 263
             
264
-            $schedNthNs=array(1,2,3,4,5,-1);
264
+            $schedNthNs = array(1, 2, 3, 4, 5, -1);
265 265
             if (in_array($scheduleNthN, $schedNthNs)) return TRUE; else return FALSE;
266 266
         }
267 267
         
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         {
270 270
             if (!is_numeric($scheduleNthWhat)) return FALSE;
271 271
             
272
-            $schedNthWhats=array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
272
+            $schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
273 273
             if (in_array($scheduleNthWhat, $schedNthWhats)) return TRUE; else return FALSE;
274 274
         }
275 275
 	}
Please login to merge, or discard this patch.
Braces   +52 added lines, -14 removed lines patch added patch discarded remove patch
@@ -197,35 +197,52 @@  discard block
 block discarded – undo
197 197
         {
198 198
             $schedMmodes=array("daily","weekly","monthly","annually");
199 199
             
200
-            if (in_array($scheduleMode, $schedMmodes)) return TRUE; else return FALSE;
200
+            if (in_array($scheduleMode, $schedMmodes)) {
201
+            	return TRUE;
202
+            } else {
203
+            	return FALSE;
204
+            }
201 205
         }
202 206
         
203 207
         public static function validateScheduleEnable($scheduleEnabled)
204 208
         {
205 209
             $schedEnambles=array(TRUE,FALSE);
206 210
             
207
-            if (in_array($scheduleEnabled, $schedEnambles)) return TRUE; else return FALSE;
211
+            if (in_array($scheduleEnabled, $schedEnambles)) {
212
+            	return TRUE;
213
+            } else {
214
+            	return FALSE;
215
+            }
208 216
         }
209 217
         
210 218
         public static function validateScheduleEvery($scheduleEvery)
211 219
         {
212
-            if (is_numeric($scheduleEvery)) return TRUE; else return FALSE;
220
+            if (is_numeric($scheduleEvery)) {
221
+            	return TRUE;
222
+            } else {
223
+            	return FALSE;
224
+            }
213 225
         }
214 226
         
215 227
         public static function validateScheduleWeekDays($scheduleWeekDays)
216 228
         {
217 229
             $weekdays = explode(',', $scheduleWeekDays);
218 230
             
219
-            if (sizeof($weekdays)<1) return FALSE;
231
+            if (sizeof($weekdays)<1) {
232
+            	return FALSE;
233
+            }
220 234
             
221 235
             $isValid=TRUE;
222 236
             
223 237
             for ($i=0; $i < sizeof($weekdays); $i++) { 
224 238
                 if (is_numeric($weekdays[$i])) {
225 239
                     $wday=intval($weekdays[$i]);
226
-                    if ($wday<1 || $wday>7) $isValid=FALSE;
240
+                    if ($wday<1 || $wday>7) {
241
+                    	$isValid=FALSE;
242
+                    }
243
+                } else {
244
+                	$isValid=FALSE;
227 245
                 }
228
-                else $isValid=FALSE;
229 246
             }
230 247
             //echo $scheduleWeekDays.' --- '. $isValid."<br>";
231 248
             return $isValid;
@@ -235,23 +252,32 @@  discard block
 block discarded – undo
235 252
         {
236 253
             $schedMonthlyMmodes=array("dates","nth");
237 254
             
238
-            if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) return TRUE; else return FALSE;
255
+            if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) {
256
+            	return TRUE;
257
+            } else {
258
+            	return FALSE;
259
+            }
239 260
         }
240 261
         
241 262
         public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
242 263
         {
243 264
             $monthlyDates = explode(',', $scheduleMonthlyDates);
244 265
             
245
-            if (sizeof($monthlyDates)<1) return FALSE;
266
+            if (sizeof($monthlyDates)<1) {
267
+            	return FALSE;
268
+            }
246 269
             
247 270
             $isValid=TRUE;
248 271
             
249 272
             for ($i=0; $i < sizeof($monthlyDates); $i++) { 
250 273
                 if (is_numeric($monthlyDates[$i])) {
251 274
                     $mday=intval($monthlyDates[$i]);
252
-                    if ($mday<1 || $mday>31) $isValid=FALSE;
275
+                    if ($mday<1 || $mday>31) {
276
+                    	$isValid=FALSE;
277
+                    }
278
+                } else {
279
+                	$isValid=FALSE;
253 280
                 }
254
-                else $isValid=FALSE;
255 281
             }
256 282
             //echo $scheduleMonthlyDates.' --- '. $isValid."<br>";
257 283
             return $isValid;
@@ -259,18 +285,30 @@  discard block
 block discarded – undo
259 285
         
260 286
         public static function validateScheduleNthN($scheduleNthN)
261 287
         {
262
-            if (!is_numeric($scheduleNthN)) return FALSE;
288
+            if (!is_numeric($scheduleNthN)) {
289
+            	return FALSE;
290
+            }
263 291
             
264 292
             $schedNthNs=array(1,2,3,4,5,-1);
265
-            if (in_array($scheduleNthN, $schedNthNs)) return TRUE; else return FALSE;
293
+            if (in_array($scheduleNthN, $schedNthNs)) {
294
+            	return TRUE;
295
+            } else {
296
+            	return FALSE;
297
+            }
266 298
         }
267 299
         
268 300
         public static function validateScheduleNthWhat($scheduleNthWhat)
269 301
         {
270
-            if (!is_numeric($scheduleNthWhat)) return FALSE;
302
+            if (!is_numeric($scheduleNthWhat)) {
303
+            	return FALSE;
304
+            }
271 305
             
272 306
             $schedNthWhats=array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
273
-            if (in_array($scheduleNthWhat, $schedNthWhats)) return TRUE; else return FALSE;
307
+            if (in_array($scheduleNthWhat, $schedNthWhats)) {
308
+            	return TRUE;
309
+            } else {
310
+            	return FALSE;
311
+            }
274 312
         }
275 313
 	}
276 314
 	
Please login to merge, or discard this patch.