@@ -207,12 +207,16 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | 209 | * @param $object: JSON object |
| 210 | + * @param \SimpleXMLElement $object |
|
| 210 | 211 | */ |
| 211 | 212 | public static function object2array($object) |
| 212 | 213 | { |
| 213 | 214 | return @json_decode(@json_encode($object), 1); |
| 214 | 215 | } |
| 215 | 216 | |
| 217 | + /** |
|
| 218 | + * @param string $url |
|
| 219 | + */ |
|
| 216 | 220 | public static function makeUrlRequst($url, $options) { |
| 217 | 221 | $method = isset($options['method']) ? $options['method'] : 'GET'; |
| 218 | 222 | $query = isset($options['query']) ? |
@@ -377,6 +381,7 @@ discard block |
||
| 377 | 381 | * Returns an array of the object properties |
| 378 | 382 | * @param $object: An object. |
| 379 | 383 | * @param $exclude: array of the object parameters to be excluded from the returned array. |
| 384 | + * @param string[] $exclude |
|
| 380 | 385 | */ |
| 381 | 386 | public static function getObjectProperties($object, $exclude) |
| 382 | 387 | { |
@@ -397,6 +402,7 @@ discard block |
||
| 397 | 402 | * Returns url path generated from the array of the fields and parameters. |
| 398 | 403 | * @param $allFields; array of the paossible fields (parameter names). |
| 399 | 404 | * @param $params: input parameters (array or object). |
| 405 | + * @param string[] $allFields |
|
| 400 | 406 | */ |
| 401 | 407 | public static function generateUrlPath($allFields, $params) |
| 402 | 408 | { |
@@ -351,70 +351,70 @@ |
||
| 351 | 351 | |
| 352 | 352 | if ($mode!='daily') { |
| 353 | 353 | switch ($mode) { |
| 354 | - case 'weekly': |
|
| 355 | - if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
| 356 | - if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
| 357 | - $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
| 358 | - } else { |
|
| 359 | - array_push($results['fail'], "$iRow --> Wrong weekdays"); |
|
| 360 | - } |
|
| 354 | + case 'weekly': |
|
| 355 | + if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
| 356 | + if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) { |
|
| 357 | + $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}'; |
|
| 361 | 358 | } else { |
| 362 | - array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); |
|
| 359 | + array_push($results['fail'], "$iRow --> Wrong weekdays"); |
|
| 363 | 360 | } |
| 364 | - break; |
|
| 365 | - case 'monthly': |
|
| 366 | - $monthlyMode = ""; |
|
| 367 | - if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
| 368 | - if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
| 369 | - $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']]; |
|
| 370 | - $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
| 371 | - } else { |
|
| 372 | - array_push($results['fail'], "$iRow --> Wrong monthly mode"); |
|
| 373 | - } |
|
| 361 | + } else { |
|
| 362 | + array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); |
|
| 363 | + } |
|
| 364 | + break; |
|
| 365 | + case 'monthly': |
|
| 366 | + $monthlyMode = ""; |
|
| 367 | + if (isset($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
| 368 | + if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) { |
|
| 369 | + $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']]; |
|
| 370 | + $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",'; |
|
| 374 | 371 | } else { |
| 375 | - array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); |
|
| 372 | + array_push($results['fail'], "$iRow --> Wrong monthly mode"); |
|
| 376 | 373 | } |
| 374 | + } else { |
|
| 375 | + array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); |
|
| 376 | + } |
|
| 377 | 377 | |
| 378 | - if ($monthlyMode!="") { |
|
| 379 | - switch ($monthlyMode) { |
|
| 380 | - case 'dates': |
|
| 381 | - if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
| 382 | - if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
| 383 | - $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
| 384 | - } else { |
|
| 385 | - array_push($results['fail'], "$iRow --> Wrong monthly dates"); |
|
| 386 | - } |
|
| 387 | - } |
|
| 388 | - break; |
|
| 389 | - case 'nth': |
|
| 390 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
| 391 | - if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
| 392 | - $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
| 393 | - } else { |
|
| 394 | - array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); |
|
| 395 | - } |
|
| 396 | - } else { |
|
| 397 | - array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); |
|
| 398 | - } |
|
| 378 | + if ($monthlyMode!="") { |
|
| 379 | + switch ($monthlyMode) { |
|
| 380 | + case 'dates': |
|
| 381 | + if (isset($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
| 382 | + if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) { |
|
| 383 | + $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}'; |
|
| 384 | + } else { |
|
| 385 | + array_push($results['fail'], "$iRow --> Wrong monthly dates"); |
|
| 386 | + } |
|
| 387 | + } |
|
| 388 | + break; |
|
| 389 | + case 'nth': |
|
| 390 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
| 391 | + if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) { |
|
| 392 | + $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].','; |
|
| 393 | + } else { |
|
| 394 | + array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); |
|
| 395 | + } |
|
| 396 | + } else { |
|
| 397 | + array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); |
|
| 398 | + } |
|
| 399 | 399 | |
| 400 | - if ($curSchedule!="") { |
|
| 401 | - if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
| 402 | - if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
| 403 | - $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}'; |
|
| 404 | - } else { |
|
| 405 | - array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); |
|
| 406 | - } |
|
| 407 | - } else { |
|
| 408 | - array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); |
|
| 409 | - } |
|
| 410 | - } |
|
| 411 | - break; |
|
| 400 | + if ($curSchedule!="") { |
|
| 401 | + if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
| 402 | + if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) { |
|
| 403 | + $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}'; |
|
| 404 | + } else { |
|
| 405 | + array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); |
|
| 412 | 406 | } |
| 407 | + } else { |
|
| 408 | + array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); |
|
| 409 | + } |
|
| 413 | 410 | } |
| 414 | 411 | break; |
| 415 | - default: |
|
| 416 | - $curSchedule = ""; |
|
| 412 | + } |
|
| 413 | + } |
|
| 417 | 414 | break; |
| 415 | + default: |
|
| 416 | + $curSchedule = ""; |
|
| 417 | + break; |
|
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | |