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.
Passed
Push — master ( 799599...7f01d7 )
by Oleg
02:53
created
examples/AddressBook/RemoveAddressBookLocations.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@  discard block
 block discarded – undo
14 14
 Route4Me::setApiKey('11111111111111111111111111111111');
15 15
 
16 16
 $AdressBookLocationParameters = AddressBookLocation::fromArray(array(
17
-    "first_name"  => "Test FirstName ".strval(rand(10000,99999)),
18
-    "address_1"   => "Test Address1 ".strval(rand(10000,99999)),
19
-    "cached_lat"  => 38.024654,
20
-    "cached_lng"  => -77.338814
17
+	"first_name"  => "Test FirstName ".strval(rand(10000,99999)),
18
+	"address_1"   => "Test Address1 ".strval(rand(10000,99999)),
19
+	"cached_lat"  => 38.024654,
20
+	"cached_lng"  => -77.338814
21 21
 ));
22 22
 
23 23
 $abContacts = new AddressBookLocation();
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 $address_id = -1;
28 28
 
29 29
 if (isset($createdContact['address_id'])) {
30
-    $address_id = $createdContact["address_id"];
30
+	$address_id = $createdContact["address_id"];
31 31
 }
32 32
 
33 33
 assert($address_id != -1, "Creating of Address Book Location was failed. Try again!.. <br>");
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Route4Me;
3 3
 
4
-$root = realpath(dirname(__FILE__) . '/../../');
5
-require $root . '/vendor/autoload.php';
4
+$root = realpath(dirname(__FILE__).'/../../');
5
+require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
8 8
 use Route4Me\Route;
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
 Route4Me::setApiKey('11111111111111111111111111111111');
15 15
 
16 16
 $AdressBookLocationParameters = AddressBookLocation::fromArray(array(
17
-    "first_name"  => "Test FirstName ".strval(rand(10000,99999)),
18
-    "address_1"   => "Test Address1 ".strval(rand(10000,99999)),
17
+    "first_name"  => "Test FirstName ".strval(rand(10000, 99999)),
18
+    "address_1"   => "Test Address1 ".strval(rand(10000, 99999)),
19 19
     "cached_lat"  => 38.024654,
20 20
     "cached_lng"  => -77.338814
21 21
 ));
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     $address_id = $createdContact["address_id"];
31 31
 }
32 32
 
33
-assert($address_id != -1, "Creating of Address Book Location was failed. Try again!.. <br>");
33
+assert($address_id!=-1, "Creating of Address Book Location was failed. Try again!.. <br>");
34 34
 
35 35
 echo "Address Book Location with address_id = ".strval($address_id)." was successfully added<br>";
36 36
 
Please login to merge, or discard this patch.
examples/Territories/DeleteTerritory.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
 
19 19
 $territoryParams['type'] = TerritoryTypes::CIRCLE;
20 20
 $territoryParams['data'] = array(
21
-    "37.569752822786455,-77.47833251953125",
22
-    "5000"
21
+	"37.569752822786455,-77.47833251953125",
22
+	"5000"
23 23
 );
24 24
 
25 25
 $TerritoryParameters = Territory::fromArray(array(
26
-    "territory_name"   => "Test Territory ".strval(rand(10000,99999)),
27
-    "territory_color"  => "ff7700",
28
-    "territory"        => $territoryParams
26
+	"territory_name"   => "Test Territory ".strval(rand(10000,99999)),
27
+	"territory_color"  => "ff7700",
28
+	"territory"        => $territoryParams
29 29
 ));
30 30
 
31 31
 $territory = new Territory();
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 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
-$root=realpath(dirname(__FILE__).'/../../');
4
+$root = realpath(dirname(__FILE__).'/../../');
5 5
 require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 );
24 24
 
25 25
 $TerritoryParameters = Territory::fromArray(array(
26
-    "territory_name"   => "Test Territory ".strval(rand(10000,99999)),
26
+    "territory_name"   => "Test Territory ".strval(rand(10000, 99999)),
27 27
     "territory_color"  => "ff7700",
28 28
     "territory"        => $territoryParams
29 29
 ));
Please login to merge, or discard this patch.
examples/Territories/CreateRectangularTerritory.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@
 block discarded – undo
16 16
 
17 17
 $territoryParams['type'] = TerritoryTypes::RECT;
18 18
 $territoryParams['data'] = array(
19
-    "43.51668853502909,-109.3798828125",
20
-    "46.98025235521883,-101.865234375"
19
+	"43.51668853502909,-109.3798828125",
20
+	"46.98025235521883,-101.865234375"
21 21
 );
22 22
 
23 23
 $TerritoryParameters = Territory::fromArray(array(
24
-    "territory_name"   => "Test Rectangular Territory ".strval(rand(10000,99999)),
25
-    "territory_color"  => "ff7700",
26
-    "territory"        => $territoryParams
24
+	"territory_name"   => "Test Rectangular Territory ".strval(rand(10000,99999)),
25
+	"territory_color"  => "ff7700",
26
+	"territory"        => $territoryParams
27 27
 ));
28 28
 
29 29
 $territory = new Territory();
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 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
-$root=realpath(dirname(__FILE__).'/../../');
4
+$root = realpath(dirname(__FILE__).'/../../');
5 5
 require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 );
22 22
 
23 23
 $TerritoryParameters = Territory::fromArray(array(
24
-    "territory_name"   => "Test Rectangular Territory ".strval(rand(10000,99999)),
24
+    "territory_name"   => "Test Rectangular Territory ".strval(rand(10000, 99999)),
25 25
     "territory_color"  => "ff7700",
26 26
     "territory"        => $territoryParams
27 27
 ));
Please login to merge, or discard this patch.
examples/Territories/UpdateTerritory.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 
19 19
 $territoryParams['type'] = TerritoryTypes::CIRCLE;
20 20
 $territoryParams['data'] = array(
21
-    "37.569752822786455,-77.47833251953125",
22
-    "5000"
21
+	"37.569752822786455,-77.47833251953125",
22
+	"5000"
23 23
 );
24 24
 
25 25
 $TerritoryParameters = Territory::fromArray(array(
26
-    "territory_name"  => "Test Territory ".strval(rand(10000,99999)),
27
-    "territory_color" => "ff7700",
28
-    "territory"       => $territoryParams
26
+	"territory_name"  => "Test Territory ".strval(rand(10000,99999)),
27
+	"territory_color" => "ff7700",
28
+	"territory"       => $territoryParams
29 29
 ));
30 30
 
31 31
 $result = (array)$territory->addTerritory($TerritoryParameters);
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
 
39 39
 // Update territory
40 40
 $territoryParameters = array (
41
-    "type" => TerritoryTypes::RECT,
42
-    "data" => array(
43
-        "29.6600127358956,-95.6593322753906",
44
-        "29.8966150753098,-95.3146362304688"
45
-       )
41
+	"type" => TerritoryTypes::RECT,
42
+	"data" => array(
43
+		"29.6600127358956,-95.6593322753906",
44
+		"29.8966150753098,-95.3146362304688"
45
+	   )
46 46
    );
47 47
 
48 48
 $TerritoryParameters = Territory::fromArray(array(
49
-    "territory_id"     => $territory_id,
50
-    "territory_name"   => "Test Territory Updated as rectangle",
51
-    "territory_color"  => "ff5500",
52
-    "territory"        => $territoryParameters
49
+	"territory_id"     => $territory_id,
50
+	"territory_name"   => "Test Territory Updated as rectangle",
51
+	"territory_color"  => "ff5500",
52
+	"territory"        => $territoryParameters
53 53
 ));
54 54
 
55 55
 $result1 = $territory->updateTerritory($TerritoryParameters);
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 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
-$root=realpath(dirname(__FILE__).'/../../');
4
+$root = realpath(dirname(__FILE__).'/../../');
5 5
 require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 );
24 24
 
25 25
 $TerritoryParameters = Territory::fromArray(array(
26
-    "territory_name"  => "Test Territory ".strval(rand(10000,99999)),
26
+    "territory_name"  => "Test Territory ".strval(rand(10000, 99999)),
27 27
     "territory_color" => "ff7700",
28 28
     "territory"       => $territoryParams
29 29
 ));
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 echo "------------------------------------------------------------------------<br><br>";
38 38
 
39 39
 // Update territory
40
-$territoryParameters = array (
40
+$territoryParameters = array(
41 41
     "type" => TerritoryTypes::RECT,
42 42
     "data" => array(
43 43
         "29.6600127358956,-95.6593322753906",
Please login to merge, or discard this patch.
examples/Territories/CreatePolygonianTerritory.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -16,21 +16,21 @@
 block discarded – undo
16 16
 
17 17
 $territoryParams['type'] = TerritoryTypes::POLY;
18 18
 $territoryParams['data'] = array(
19
-    "37.769752822786455,-77.67833251953125",
20
-    "37.75886716305343,-77.68974800109863",
21
-    "37.74763966054455,-77.6917221069336",
22
-    "37.74655084306813,-77.68863220214844",
23
-    "37.7502255383101,-77.68125076293945",
24
-    "37.74797991274437,-77.67498512268066",
25
-    "37.73327960206065,-77.6411678314209",
26
-    "37.74430510679532,-77.63172645568848",
27
-    "37.76641925847049,-77.66846199035645"
19
+	"37.769752822786455,-77.67833251953125",
20
+	"37.75886716305343,-77.68974800109863",
21
+	"37.74763966054455,-77.6917221069336",
22
+	"37.74655084306813,-77.68863220214844",
23
+	"37.7502255383101,-77.68125076293945",
24
+	"37.74797991274437,-77.67498512268066",
25
+	"37.73327960206065,-77.6411678314209",
26
+	"37.74430510679532,-77.63172645568848",
27
+	"37.76641925847049,-77.66846199035645"
28 28
 );
29 29
 
30 30
 $TerritoryParameters=Territory::fromArray(array(
31
-    "territory_name"   => "Test Polygonian Territory ".strval(rand(10000,99999)),
32
-    "territory_color"  => "ff7700",
33
-    "territory"        => $territoryParams
31
+	"territory_name"   => "Test Polygonian Territory ".strval(rand(10000,99999)),
32
+	"territory_color"  => "ff7700",
33
+	"territory"        => $territoryParams
34 34
 ));
35 35
 
36 36
 $territory = new Territory();
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 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
-$root=realpath(dirname(__FILE__).'/../../');
4
+$root = realpath(dirname(__FILE__).'/../../');
5 5
 require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
     "37.76641925847049,-77.66846199035645"
28 28
 );
29 29
 
30
-$TerritoryParameters=Territory::fromArray(array(
31
-    "territory_name"   => "Test Polygonian Territory ".strval(rand(10000,99999)),
30
+$TerritoryParameters = Territory::fromArray(array(
31
+    "territory_name"   => "Test Polygonian Territory ".strval(rand(10000, 99999)),
32 32
     "territory_color"  => "ff7700",
33 33
     "territory"        => $territoryParams
34 34
 ));
Please login to merge, or discard this patch.
examples/Territories/GetTerritory.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 
19 19
 $territoryParams['type'] = TerritoryTypes::CIRCLE;
20 20
 $territoryParams['data'] = array(
21
-    "37.569752822786455,-77.47833251953125",
22
-    "5000"
21
+	"37.569752822786455,-77.47833251953125",
22
+	"5000"
23 23
 );
24 24
 
25 25
 $TerritoryParameters = Territory::fromArray(array(
26
-    "territory_name"   => "Test Territory ".strval(rand(10000,99999)),
27
-    "territory_color"  => "ff7700",
28
-    "territory"        => $territoryParams
26
+	"territory_name"   => "Test Territory ".strval(rand(10000,99999)),
27
+	"territory_color"  => "ff7700",
28
+	"territory"        => $territoryParams
29 29
 ));
30 30
 
31 31
 $territory = new Territory();
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 echo "------------------------------------------------------------------------<br><br>";
42 42
 
43 43
 $params = array(
44
-    "territory_id" => $territory_id
44
+	"territory_id" => $territory_id
45 45
 );
46 46
 
47 47
 $result1 = $territory->getTerritory($params);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 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
-$root=realpath(dirname(__FILE__).'/../../');
4
+$root = realpath(dirname(__FILE__).'/../../');
5 5
 require $root.'/vendor/autoload.php';
6 6
 
7 7
 use Route4Me\Route4Me;
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 );
24 24
 
25 25
 $TerritoryParameters = Territory::fromArray(array(
26
-    "territory_name"   => "Test Territory ".strval(rand(10000,99999)),
26
+    "territory_name"   => "Test Territory ".strval(rand(10000, 99999)),
27 27
     "territory_color"  => "ff7700",
28 28
     "territory"        => $territoryParams
29 29
 ));
Please login to merge, or discard this patch.
src/Route4Me/OptimizationProblem.php 2 patches
Indentation   +220 added lines, -220 removed lines patch added patch discarded remove patch
@@ -11,271 +11,271 @@
 block discarded – undo
11 11
 
12 12
 class OptimizationProblem extends Common
13 13
 {
14
-    public $optimization_problem_id;
15
-    public $user_errors = array();
16
-    public $state;
17
-    public $optimization_errors = array();
18
-    public $parameters;
19
-    public $sent_to_background;
20
-    public $created_timestamp;
21
-    public $scheduled_for;
22
-    public $optimization_completed_timestamp;
23
-    public $addresses = array();
24
-    public $routes = array();
25
-    public $links = array();
14
+	public $optimization_problem_id;
15
+	public $user_errors = array();
16
+	public $state;
17
+	public $optimization_errors = array();
18
+	public $parameters;
19
+	public $sent_to_background;
20
+	public $created_timestamp;
21
+	public $scheduled_for;
22
+	public $optimization_completed_timestamp;
23
+	public $addresses = array();
24
+	public $routes = array();
25
+	public $links = array();
26 26
 
27
-    function __construct()
28
-    {
29
-        $this->parameters = new RouteParameters;
30
-    }
27
+	function __construct()
28
+	{
29
+		$this->parameters = new RouteParameters;
30
+	}
31 31
 
32
-    public static function fromArray(array $params)
33
-    {
34
-        $problem = new OptimizationProblem;
35
-        $problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
36
-        $problem->user_errors = Common::getValue($params, 'user_errors', array());
37
-        $problem->state = Common::getValue($params, 'state', array());
38
-        $problem->sent_to_background = Common::getValue($params, 'sent_to_background', array());
39
-        $problem->links = Common::getValue($params, 'links', array());
32
+	public static function fromArray(array $params)
33
+	{
34
+		$problem = new OptimizationProblem;
35
+		$problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
36
+		$problem->user_errors = Common::getValue($params, 'user_errors', array());
37
+		$problem->state = Common::getValue($params, 'state', array());
38
+		$problem->sent_to_background = Common::getValue($params, 'sent_to_background', array());
39
+		$problem->links = Common::getValue($params, 'links', array());
40 40
 
41
-        if (isset($params['parameters'])) {
42
-            $problem->parameters = RouteParameters::fromArray($params['parameters']);
43
-        }
41
+		if (isset($params['parameters'])) {
42
+			$problem->parameters = RouteParameters::fromArray($params['parameters']);
43
+		}
44 44
 
45
-        if (isset($params['addresses'])) {
46
-            $addresses = array();
45
+		if (isset($params['addresses'])) {
46
+			$addresses = array();
47 47
             
48
-            foreach ($params['addresses'] as $address) {
49
-                $addresses[] = Address::fromArray($address);
50
-            }
48
+			foreach ($params['addresses'] as $address) {
49
+				$addresses[] = Address::fromArray($address);
50
+			}
51 51
             
52
-            $problem->addresses = $addresses;
53
-        }
52
+			$problem->addresses = $addresses;
53
+		}
54 54
 
55
-        if (isset($params['routes'])) {
56
-            $routes = array();
55
+		if (isset($params['routes'])) {
56
+			$routes = array();
57 57
             
58
-            foreach ($params['routes'] as $route) {
59
-                $routes[] = Route::fromArray($route);
60
-            }
58
+			foreach ($params['routes'] as $route) {
59
+				$routes[] = Route::fromArray($route);
60
+			}
61 61
             
62
-            $problem->routes = $routes;
63
-        }
62
+			$problem->routes = $routes;
63
+		}
64 64
 
65
-        return $problem;
66
-    }
65
+		return $problem;
66
+	}
67 67
 
68
-    public static function optimize(OptimizationProblemParams $params)
69
-    {
70
-        $optimize = Route4Me::makeRequst(array(
71
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
72
-            'method' => 'POST',
73
-            'query'  => array(
74
-                'redirect'               => isset($params->redirect) ? $params->redirect : null,
75
-                'directions'             => isset($params->directions) ? $params->directions : null, 
76
-                'format'                 => isset($params->format) ? $params->format : null,
77
-                'route_path_output'      => isset($params->route_path_output) ? $params->route_path_output : null,
78
-                'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url : null
79
-            ),
80
-            'body'   => array(
81
-                'addresses'  => $params->getAddressesArray(),
82
-                'parameters' => $params->getParametersArray()
83
-            )
84
-        ));
68
+	public static function optimize(OptimizationProblemParams $params)
69
+	{
70
+		$optimize = Route4Me::makeRequst(array(
71
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
72
+			'method' => 'POST',
73
+			'query'  => array(
74
+				'redirect'               => isset($params->redirect) ? $params->redirect : null,
75
+				'directions'             => isset($params->directions) ? $params->directions : null, 
76
+				'format'                 => isset($params->format) ? $params->format : null,
77
+				'route_path_output'      => isset($params->route_path_output) ? $params->route_path_output : null,
78
+				'optimized_callback_url' => isset($params->optimized_callback_url) ? $params->optimized_callback_url : null
79
+			),
80
+			'body'   => array(
81
+				'addresses'  => $params->getAddressesArray(),
82
+				'parameters' => $params->getParametersArray()
83
+			)
84
+		));
85 85
 
86
-        return OptimizationProblem::fromArray($optimize);
87
-    }
86
+		return OptimizationProblem::fromArray($optimize);
87
+	}
88 88
 
89
-    public static function get($params)
90
-    {
91
-        $optimize = Route4Me::makeRequst(array(
92
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
93
-            'method' => 'GET',
94
-            'query'  => array(
95
-                'state'  => isset($params['state']) ? $params['state'] : null,
96
-                'limit'  => isset($params['limit']) ? $params['limit'] : null,
97
-                'offset' => isset($params['offset']) ? $params['offset'] : null,
98
-                'optimization_problem_id' => isset($params['optimization_problem_id']) 
99
-                    ? $params['optimization_problem_id'] : null,
100
-                'wait_for_final_state' => isset($params['wait_for_final_state']) 
101
-                    ? $params['wait_for_final_state'] : null,
102
-            )
103
-        ));
89
+	public static function get($params)
90
+	{
91
+		$optimize = Route4Me::makeRequst(array(
92
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
93
+			'method' => 'GET',
94
+			'query'  => array(
95
+				'state'  => isset($params['state']) ? $params['state'] : null,
96
+				'limit'  => isset($params['limit']) ? $params['limit'] : null,
97
+				'offset' => isset($params['offset']) ? $params['offset'] : null,
98
+				'optimization_problem_id' => isset($params['optimization_problem_id']) 
99
+					? $params['optimization_problem_id'] : null,
100
+				'wait_for_final_state' => isset($params['wait_for_final_state']) 
101
+					? $params['wait_for_final_state'] : null,
102
+			)
103
+		));
104 104
 
105
-        if (isset($optimize['optimizations'])) {
106
-            $problems = array();
105
+		if (isset($optimize['optimizations'])) {
106
+			$problems = array();
107 107
             
108
-            foreach ($optimize['optimizations'] as $problem) {
109
-                $problems[] = OptimizationProblem::fromArray($problem);
110
-            }
108
+			foreach ($optimize['optimizations'] as $problem) {
109
+				$problems[] = OptimizationProblem::fromArray($problem);
110
+			}
111 111
             
112
-            return $problems;
113
-        } else {
114
-            return OptimizationProblem::fromArray($optimize);
115
-        }
116
-    }
112
+			return $problems;
113
+		} else {
114
+			return OptimizationProblem::fromArray($optimize);
115
+		}
116
+	}
117 117
 
118
-    public static function reoptimize($params)
119
-    {
120
-        $param = new OptimizationProblemParams;
121
-        $param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null;
122
-        $param->reoptimize = 1;
118
+	public static function reoptimize($params)
119
+	{
120
+		$param = new OptimizationProblemParams;
121
+		$param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null;
122
+		$param->reoptimize = 1;
123 123
 
124
-        return self::update((array)$param);
125
-    }
124
+		return self::update((array)$param);
125
+	}
126 126
 
127
-    public static function update($params)
128
-    {
129
-        $optimize = Route4Me::makeRequst(array(
130
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
131
-            'method' => 'PUT',
132
-            'query'  => array(
133
-                'optimization_problem_id' => isset($params['optimization_problem_id'])
134
-                                               ? $params['optimization_problem_id'] : null,
135
-                'addresses'  => isset($params['addresses']) ? $params['addresses'] : null,
136
-                'reoptimize' => isset($params['reoptimize']) ? $params['reoptimize'] : null,
137
-            )
138
-        ));
127
+	public static function update($params)
128
+	{
129
+		$optimize = Route4Me::makeRequst(array(
130
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
131
+			'method' => 'PUT',
132
+			'query'  => array(
133
+				'optimization_problem_id' => isset($params['optimization_problem_id'])
134
+											   ? $params['optimization_problem_id'] : null,
135
+				'addresses'  => isset($params['addresses']) ? $params['addresses'] : null,
136
+				'reoptimize' => isset($params['reoptimize']) ? $params['reoptimize'] : null,
137
+			)
138
+		));
139 139
         
140
-        return $optimize;
141
-    }
140
+		return $optimize;
141
+	}
142 142
 
143
-    public function getOptimizationId()
144
-    {
145
-        return $this->optimization_problem_id;
146
-    }
143
+	public function getOptimizationId()
144
+	{
145
+		return $this->optimization_problem_id;
146
+	}
147 147
 
148
-    public function getRoutes()
149
-    {
150
-        return $this->routes;
151
-    }
148
+	public function getRoutes()
149
+	{
150
+		return $this->routes;
151
+	}
152 152
     
153
-    public function getRandomOptimizationId($offset, $limit)
154
-    {
155
-        $query['limit'] = !is_null($limit) ? $limit : 30;
156
-        $query['offset'] = !is_null($offset) ? $offset : 0;
153
+	public function getRandomOptimizationId($offset, $limit)
154
+	{
155
+		$query['limit'] = !is_null($limit) ? $limit : 30;
156
+		$query['offset'] = !is_null($offset) ? $offset : 0;
157 157
             
158
-        $json = Route4Me::makeRequst(array(
159
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
160
-            'method' => 'GET',
161
-            'query'  => $query
162
-        ));
158
+		$json = Route4Me::makeRequst(array(
159
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
160
+			'method' => 'GET',
161
+			'query'  => $query
162
+		));
163 163
         
164
-        $optimizations = array();
165
-            foreach ($json as $optimization) {
166
-                if (gettype($optimization)!="array") {
167
-                   continue; 
168
-                }
164
+		$optimizations = array();
165
+			foreach ($json as $optimization) {
166
+				if (gettype($optimization)!="array") {
167
+				   continue; 
168
+				}
169 169
                 
170
-                foreach ($optimization as $otp1) {
171
-                    $optimizations[] = $otp1;
172
-                }
173
-            }
170
+				foreach ($optimization as $otp1) {
171
+					$optimizations[] = $otp1;
172
+				}
173
+			}
174 174
             
175
-            $num = rand(0,sizeof($optimizations)-1);
175
+			$num = rand(0,sizeof($optimizations)-1);
176 176
             
177
-            $rOptimization = $optimizations[$num];
177
+			$rOptimization = $optimizations[$num];
178 178
             
179
-            return $rOptimization['optimization_problem_id'];
180
-    }
179
+			return $rOptimization['optimization_problem_id'];
180
+	}
181 181
     
182
-    public function getAddresses($opt_id)
183
-    {
184
-        if ($opt_id==null) {
185
-            return null;
186
-        }
182
+	public function getAddresses($opt_id)
183
+	{
184
+		if ($opt_id==null) {
185
+			return null;
186
+		}
187 187
         
188
-        $params = array("optimization_problem_id" => $opt_id );
188
+		$params = array("optimization_problem_id" => $opt_id );
189 189
         
190
-        $optimization = (array)$this->get($params);
190
+		$optimization = (array)$this->get($params);
191 191
         
192
-        $addresses = $optimization["addresses"];
192
+		$addresses = $optimization["addresses"];
193 193
         
194
-        return $addresses;
195
-    }
194
+		return $addresses;
195
+	}
196 196
     
197
-    public function getRandomAddressFromOptimization($opt_id)
198
-    {
199
-        $addresses = (array)$this->getAddresses($opt_id);
197
+	public function getRandomAddressFromOptimization($opt_id)
198
+	{
199
+		$addresses = (array)$this->getAddresses($opt_id);
200 200
         
201
-        if ($addresses==null) {
202
-            echo "There are no addresses in this optimization!.. Try again.";
203
-            return null;
204
-        }
201
+		if ($addresses==null) {
202
+			echo "There are no addresses in this optimization!.. Try again.";
203
+			return null;
204
+		}
205 205
         
206
-        $num = rand(0, sizeof($addresses)-1);
206
+		$num = rand(0, sizeof($addresses)-1);
207 207
         
208
-        $rAddress = $addresses[$num];
208
+		$rAddress = $addresses[$num];
209 209
         
210
-        return $rAddress;
211
-    }
210
+		return $rAddress;
211
+	}
212 212
     
213
-    public function removeAddress($params)
214
-    {
215
-        $response = Route4Me::makeRequst(array(
216
-            'url'    => Endpoint::ADDRESS_V4,
217
-            'method' => 'DELETE',
218
-            'query'  => array(
219
-                'optimization_problem_id' => isset($params['optimization_problem_id'])
220
-                                               ? $params['optimization_problem_id'] : null,
221
-                'route_destination_id'    => isset($params['route_destination_id'])
222
-                                               ? $params['route_destination_id'] : null,
223
-            )
224
-        ));
213
+	public function removeAddress($params)
214
+	{
215
+		$response = Route4Me::makeRequst(array(
216
+			'url'    => Endpoint::ADDRESS_V4,
217
+			'method' => 'DELETE',
218
+			'query'  => array(
219
+				'optimization_problem_id' => isset($params['optimization_problem_id'])
220
+											   ? $params['optimization_problem_id'] : null,
221
+				'route_destination_id'    => isset($params['route_destination_id'])
222
+											   ? $params['route_destination_id'] : null,
223
+			)
224
+		));
225 225
         
226
-        return $response;
227
-    }
226
+		return $response;
227
+	}
228 228
     
229
-    public function removeOptimization($params)
230
-    {
231
-        $response = Route4Me::makeRequst(array(
232
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
233
-            'method' => 'DELETE',
234
-            'query'  => array(
235
-                'redirect' => isset($params['redirect']) ? $params['redirect'] : null,
236
-            ),
237
-            'body'   => array(
238
-                'optimization_problem_ids' => isset($params['optimization_problem_ids'])
239
-                                                ? $params['optimization_problem_ids'] : null,
240
-            )
241
-        ));
229
+	public function removeOptimization($params)
230
+	{
231
+		$response = Route4Me::makeRequst(array(
232
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
233
+			'method' => 'DELETE',
234
+			'query'  => array(
235
+				'redirect' => isset($params['redirect']) ? $params['redirect'] : null,
236
+			),
237
+			'body'   => array(
238
+				'optimization_problem_ids' => isset($params['optimization_problem_ids'])
239
+												? $params['optimization_problem_ids'] : null,
240
+			)
241
+		));
242 242
         
243
-        return $response;
244
-    }
243
+		return $response;
244
+	}
245 245
     
246
-    public function getHybridOptimization($params)
247
-    {
248
-        $optimize = Route4Me::makeRequst(array(
249
-            'url'    => Endpoint::HYBRID_DATE_OPTIMIZATION,
250
-            'method' => 'GET',
251
-            'query'  => array(
252
-                'target_date_string'      => isset($params['target_date_string'])
253
-                                               ? $params['target_date_string'] : null,
254
-                'timezone_offset_minutes' => isset($params['timezone_offset_minutes'])
255
-                                               ? $params['timezone_offset_minutes'] : null
256
-            )
257
-        ));
246
+	public function getHybridOptimization($params)
247
+	{
248
+		$optimize = Route4Me::makeRequst(array(
249
+			'url'    => Endpoint::HYBRID_DATE_OPTIMIZATION,
250
+			'method' => 'GET',
251
+			'query'  => array(
252
+				'target_date_string'      => isset($params['target_date_string'])
253
+											   ? $params['target_date_string'] : null,
254
+				'timezone_offset_minutes' => isset($params['timezone_offset_minutes'])
255
+											   ? $params['timezone_offset_minutes'] : null
256
+			)
257
+		));
258 258
 
259
-        return $optimize;
260
-    }
259
+		return $optimize;
260
+	}
261 261
     
262
-    Public function addDepotsToHybrid($params)
263
-    {
264
-        $depots = Route4Me::makeRequst(array( 
265
-            'url'    => Endpoint::CHANGE_HYBRID_OPTIMIZATION_DEPOT,
266
-            'method' => 'POST',
267
-            'query'  => array(
268
-                'optimization_problem_id' => isset($params['optimization_problem_id'])
269
-                                               ? $params['optimization_problem_id'] : null,
270
-                ),
271
-            'body'   => array(
272
-                'optimization_problem_id' => isset($params['optimization_problem_id'])
273
-                                               ? $params['optimization_problem_id'] : null,
274
-                'delete_old_depots'       => isset($params['delete_old_depots']) ? $params['delete_old_depots'] : null,
275
-                'new_depots'              => isset($params['new_depots']) ? $params['new_depots'] : null,
276
-            )
277
-        ));
262
+	Public function addDepotsToHybrid($params)
263
+	{
264
+		$depots = Route4Me::makeRequst(array( 
265
+			'url'    => Endpoint::CHANGE_HYBRID_OPTIMIZATION_DEPOT,
266
+			'method' => 'POST',
267
+			'query'  => array(
268
+				'optimization_problem_id' => isset($params['optimization_problem_id'])
269
+											   ? $params['optimization_problem_id'] : null,
270
+				),
271
+			'body'   => array(
272
+				'optimization_problem_id' => isset($params['optimization_problem_id'])
273
+											   ? $params['optimization_problem_id'] : null,
274
+				'delete_old_depots'       => isset($params['delete_old_depots']) ? $params['delete_old_depots'] : null,
275
+				'new_depots'              => isset($params['new_depots']) ? $params['new_depots'] : null,
276
+			)
277
+		));
278 278
         
279
-        return $depots;
280
-    }
279
+		return $depots;
280
+	}
281 281
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                 }
173 173
             }
174 174
             
175
-            $num = rand(0,sizeof($optimizations)-1);
175
+            $num = rand(0, sizeof($optimizations) - 1);
176 176
             
177 177
             $rOptimization = $optimizations[$num];
178 178
             
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
             return null;
186 186
         }
187 187
         
188
-        $params = array("optimization_problem_id" => $opt_id );
188
+        $params = array("optimization_problem_id" => $opt_id);
189 189
         
190 190
         $optimization = (array)$this->get($params);
191 191
         
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
             return null;
204 204
         }
205 205
         
206
-        $num = rand(0, sizeof($addresses)-1);
206
+        $num = rand(0, sizeof($addresses) - 1);
207 207
         
208 208
         $rAddress = $addresses[$num];
209 209
         
Please login to merge, or discard this patch.
src/Route4Me/Order.php 3 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     public static function getOrder($params)
133 133
     {
134 134
         $query = array();
135
-        $allGetParameters = array('order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' );
135
+        $allGetParameters = array('order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit');
136 136
         
137 137
         foreach ($allGetParameters as $getParameter) {
138 138
             if (isset($params->{$getParameter})) $query[$getParameter] = $params->{$getParameter};
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     public static function searchOrder($params)
231 231
     {
232 232
         $query = array();
233
-        $allSearchParameters = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' );
233
+        $allSearchParameters = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit');
234 234
         
235 235
         foreach ($allSearchParameters as $searchParameter) {
236 236
             if (isset($params->{$searchParameter})) $query[$searchParameter] = $params->{$searchParameter};
@@ -282,17 +282,17 @@  discard block
 block discarded – undo
282 282
         
283 283
         $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
284 284
         
285
-        $allOrderFields = array("curbside_lat","curbside_lng","color","day_scheduled_for_YYMMDD",
286
-                "address_alias","address_1","address_2","local_time_window_start","local_time_window_end","local_time_window_start_2",
287
-                "local_time_window_end_2","service_time","EXT_FIELD_first_name","EXT_FIELD_last_name","EXT_FIELD_email","EXT_FIELD_phone",
288
-                "EXT_FIELD_custom_data","order_icon");
285
+        $allOrderFields = array("curbside_lat", "curbside_lng", "color", "day_scheduled_for_YYMMDD",
286
+                "address_alias", "address_1", "address_2", "local_time_window_start", "local_time_window_end", "local_time_window_start_2",
287
+                "local_time_window_end_2", "service_time", "EXT_FIELD_first_name", "EXT_FIELD_last_name", "EXT_FIELD_email", "EXT_FIELD_phone",
288
+                "EXT_FIELD_custom_data", "order_icon");
289 289
         
290 290
         if (!empty($columns)) {
291
-             array_push($results['fail'],'Empty CSV table');
291
+             array_push($results['fail'], 'Empty CSV table');
292 292
              return ($results);
293 293
         }
294 294
                  
295
-        $iRow=1;
295
+        $iRow = 1;
296 296
         
297 297
         while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
298 298
             if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null)!==$rows) {
@@ -336,19 +336,19 @@  discard block
 block discarded – undo
336 336
                 $address = $rows[$ordersFieldsMapping['address_1']];
337 337
                 
338 338
                 if (isset($ordersFieldsMapping['order_city'])) {
339
-                    $address.=', '.$rows[$ordersFieldsMapping['order_city']];
339
+                    $address .= ', '.$rows[$ordersFieldsMapping['order_city']];
340 340
                 }
341 341
                 
342 342
                 if (isset($ordersFieldsMapping['order_state_id'])) {
343
-                    $address.=', '.$rows[$ordersFieldsMapping['order_state_id']];
343
+                    $address .= ', '.$rows[$ordersFieldsMapping['order_state_id']];
344 344
                 }
345 345
                 
346 346
                 if (isset($ordersFieldsMapping['order_zip_code'])) {
347
-                    $address.=', '.$rows[$ordersFieldsMapping['order_zip_code']];
347
+                    $address .= ', '.$rows[$ordersFieldsMapping['order_zip_code']];
348 348
                 }
349 349
                 
350 350
                 if (isset($ordersFieldsMapping['order_country_id'])) {
351
-                    $address.=', '.$rows[$ordersFieldsMapping['order_country_id']];
351
+                    $address .= ', '.$rows[$ordersFieldsMapping['order_country_id']];
352 352
                 }
353 353
                 
354 354
                 echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].", ".$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']]."<br>";
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -86,7 +86,9 @@  discard block
 block discarded – undo
86 86
         'is_completed', 'custom_user_fields');
87 87
         
88 88
         foreach ($allAddOrderParameters as $addOrderParameter) {
89
-            if (isset($params->{$addOrderParameter})) $body[$addOrderParameter] = $params->{$addOrderParameter};
89
+            if (isset($params->{$addOrderParameter})) {
90
+            	$body[$addOrderParameter] = $params->{$addOrderParameter};
91
+            }
90 92
         }
91 93
        
92 94
         $response = Route4Me::makeRequst(array(
@@ -135,7 +137,9 @@  discard block
 block discarded – undo
135 137
         $allGetParameters = array('order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' );
136 138
         
137 139
         foreach ($allGetParameters as $getParameter) {
138
-            if (isset($params->{$getParameter})) $query[$getParameter] = $params->{$getParameter};
140
+            if (isset($params->{$getParameter})) {
141
+            	$query[$getParameter] = $params->{$getParameter};
142
+            }
139 143
         }
140 144
 
141 145
         $response = Route4Me::makeRequst(array(
@@ -233,7 +237,9 @@  discard block
 block discarded – undo
233 237
         $allSearchParameters = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' );
234 238
         
235 239
         foreach ($allSearchParameters as $searchParameter) {
236
-            if (isset($params->{$searchParameter})) $query[$searchParameter] = $params->{$searchParameter};
240
+            if (isset($params->{$searchParameter})) {
241
+            	$query[$searchParameter] = $params->{$searchParameter};
242
+            }
237 243
         }
238 244
         
239 245
         $response = Route4Me::makeRequst(array(
@@ -372,8 +378,7 @@  discard block
 block discarded – undo
372 378
                 $orderResults = $order->addOrder($orderParameters);
373 379
                 
374 380
                 array_push($results['success'], "The order with order_id = ".strval($orderResults["order_id"])." added successfuly.");
375
-            }
376
-            else {
381
+            } else {
377 382
                 array_push($results['fail'], "$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); 
378 383
             }
379 384
             
Please login to merge, or discard this patch.
Indentation   +293 added lines, -293 removed lines patch added patch discarded remove patch
@@ -6,372 +6,372 @@
 block discarded – undo
6 6
 
7 7
 class Order extends Common
8 8
 {
9
-    public $address_1;
10
-    public $address_2;
11
-    public $cached_lat;
12
-    public $cached_lng;
13
-    public $curbside_lat;
14
-    public $curbside_lng;
15
-    public $address_alias;
16
-    public $address_city;
17
-    public $EXT_FIELD_first_name;
18
-    public $EXT_FIELD_last_name;
19
-    public $EXT_FIELD_email;
20
-    public $EXT_FIELD_phone;
21
-    public $EXT_FIELD_custom_data;
9
+	public $address_1;
10
+	public $address_2;
11
+	public $cached_lat;
12
+	public $cached_lng;
13
+	public $curbside_lat;
14
+	public $curbside_lng;
15
+	public $address_alias;
16
+	public $address_city;
17
+	public $EXT_FIELD_first_name;
18
+	public $EXT_FIELD_last_name;
19
+	public $EXT_FIELD_email;
20
+	public $EXT_FIELD_phone;
21
+	public $EXT_FIELD_custom_data;
22 22
     
23
-    public $color;
24
-    public $order_icon;
25
-    public $local_time_window_start;
26
-    public $local_time_window_end;
27
-    public $local_time_window_start_2;
28
-    public $local_time_window_end_2;
29
-    public $service_time;
23
+	public $color;
24
+	public $order_icon;
25
+	public $local_time_window_start;
26
+	public $local_time_window_end;
27
+	public $local_time_window_start_2;
28
+	public $local_time_window_end_2;
29
+	public $service_time;
30 30
     
31
-    public $day_scheduled_for_YYMMDD;
31
+	public $day_scheduled_for_YYMMDD;
32 32
     
33
-    public $route_id;
34
-    public $redirect;
35
-    public $optimization_problem_id;
36
-    public $order_id;
37
-    public $order_ids;
33
+	public $route_id;
34
+	public $redirect;
35
+	public $optimization_problem_id;
36
+	public $order_id;
37
+	public $order_ids;
38 38
     
39
-    public $day_added_YYMMDD;
40
-    public $scheduled_for_YYMMDD;
41
-    public $fields;
42
-    public $offset;
43
-    public $limit;
44
-    public $query;
39
+	public $day_added_YYMMDD;
40
+	public $scheduled_for_YYMMDD;
41
+	public $fields;
42
+	public $offset;
43
+	public $limit;
44
+	public $query;
45 45
     
46
-    public $created_timestamp;
47
-    public $order_status_id;
48
-    public $member_id;
49
-    public $address_state_id;
50
-    public $address_country_id;
51
-    public $address_zip;
52
-    public $in_route_count;
53
-    public $last_visited_timestamp;
54
-    public $last_routed_timestamp;
55
-    public $local_timezone_string;
56
-    public $is_validated;
57
-    public $is_pending;
58
-    public $is_accepted;
59
-    public $is_started;
60
-    public $is_completed;
61
-    public $custom_user_fields;
46
+	public $created_timestamp;
47
+	public $order_status_id;
48
+	public $member_id;
49
+	public $address_state_id;
50
+	public $address_country_id;
51
+	public $address_zip;
52
+	public $in_route_count;
53
+	public $last_visited_timestamp;
54
+	public $last_routed_timestamp;
55
+	public $local_timezone_string;
56
+	public $is_validated;
57
+	public $is_pending;
58
+	public $is_accepted;
59
+	public $is_started;
60
+	public $is_completed;
61
+	public $custom_user_fields;
62 62
     
63
-    public static function fromArray(array $params) {
64
-        $order = new Order();
65
-        foreach ($params as $key => $value) {
66
-            if (property_exists($order, $key)) {
67
-                $order->{$key} = $value;
68
-            }
69
-        }
63
+	public static function fromArray(array $params) {
64
+		$order = new Order();
65
+		foreach ($params as $key => $value) {
66
+			if (property_exists($order, $key)) {
67
+				$order->{$key} = $value;
68
+			}
69
+		}
70 70
         
71
-        return $order;
72
-    }
71
+		return $order;
72
+	}
73 73
     
74
-    /**
75
-     * @param Order $params
76
-     */
77
-    public static function addOrder($params)
78
-    {
79
-        $body = array();
74
+	/**
75
+	 * @param Order $params
76
+	 */
77
+	public static function addOrder($params)
78
+	{
79
+		$body = array();
80 80
         
81
-        $allAddOrderParameters = array('address_1', 'address_2', 'member_id', 'cached_lat', 'cached_lng', 'curbside_lat', 
82
-        'curbside_lng', 'color', 'order_icon', 'day_scheduled_for_YYMMDD', 'address_alias', 'address_city', 'address_state_id', 
83
-        'address_country_id', 'address_zip', 'local_time_window_start', 'local_time_window_end', 'local_time_window_start_2', 
84
-        'local_time_window_end_2', 'service_time', 'local_timezone_string', 'EXT_FIELD_first_name', 'EXT_FIELD_last_name', 
85
-        'EXT_FIELD_email', 'EXT_FIELD_phone', 'EXT_FIELD_custom_data', 'is_validated', 'is_pending', 'is_accepted', 'is_started', 
86
-        'is_completed', 'custom_user_fields');
81
+		$allAddOrderParameters = array('address_1', 'address_2', 'member_id', 'cached_lat', 'cached_lng', 'curbside_lat', 
82
+		'curbside_lng', 'color', 'order_icon', 'day_scheduled_for_YYMMDD', 'address_alias', 'address_city', 'address_state_id', 
83
+		'address_country_id', 'address_zip', 'local_time_window_start', 'local_time_window_end', 'local_time_window_start_2', 
84
+		'local_time_window_end_2', 'service_time', 'local_timezone_string', 'EXT_FIELD_first_name', 'EXT_FIELD_last_name', 
85
+		'EXT_FIELD_email', 'EXT_FIELD_phone', 'EXT_FIELD_custom_data', 'is_validated', 'is_pending', 'is_accepted', 'is_started', 
86
+		'is_completed', 'custom_user_fields');
87 87
         
88
-        foreach ($allAddOrderParameters as $addOrderParameter) {
89
-            if (isset($params->{$addOrderParameter})) $body[$addOrderParameter] = $params->{$addOrderParameter};
90
-        }
88
+		foreach ($allAddOrderParameters as $addOrderParameter) {
89
+			if (isset($params->{$addOrderParameter})) $body[$addOrderParameter] = $params->{$addOrderParameter};
90
+		}
91 91
        
92
-        $response = Route4Me::makeRequst(array(
93
-            'url'    => Endpoint::ORDER_V4,
94
-            'method' => 'POST',
95
-            'body'   => $body
96
-        ));
92
+		$response = Route4Me::makeRequst(array(
93
+			'url'    => Endpoint::ORDER_V4,
94
+			'method' => 'POST',
95
+			'body'   => $body
96
+		));
97 97
 
98
-        return $response;
99
-    }
98
+		return $response;
99
+	}
100 100
 
101
-    public static function addOrder2Route($params, $body)
102
-    {
103
-        $response = Route4Me::makeRequst(array(
104
-            'url'    => Endpoint::ROUTE_V4,
105
-            'method' => 'PUT',
106
-            'query'  => array(
107
-                'route_id' => isset($params->route_id) ? $params->route_id : null,
108
-                'redirect' => isset($params->redirect) ? $params->redirect : null
109
-            ),
110
-            'body' => (array)$body
111
-        ));
101
+	public static function addOrder2Route($params, $body)
102
+	{
103
+		$response = Route4Me::makeRequst(array(
104
+			'url'    => Endpoint::ROUTE_V4,
105
+			'method' => 'PUT',
106
+			'query'  => array(
107
+				'route_id' => isset($params->route_id) ? $params->route_id : null,
108
+				'redirect' => isset($params->redirect) ? $params->redirect : null
109
+			),
110
+			'body' => (array)$body
111
+		));
112 112
 
113
-        return $response;
114
-    }
113
+		return $response;
114
+	}
115 115
     
116
-    public static function addOrder2Optimization($params, $body)
117
-    {
118
-        $response = Route4Me::makeRequst(array(
119
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
120
-            'method' => 'PUT',
121
-            'query'  => array(
122
-                'optimization_problem_id' =>  isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
123
-                'redirect'                => isset($params['redirect']) ? $params['redirect'] : null,
124
-                'device_type'             => isset($params['device_type']) ? $params['device_type'] : null
125
-            ),
126
-            'body'  => (array)$body
127
-        ));
116
+	public static function addOrder2Optimization($params, $body)
117
+	{
118
+		$response = Route4Me::makeRequst(array(
119
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
120
+			'method' => 'PUT',
121
+			'query'  => array(
122
+				'optimization_problem_id' =>  isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null,
123
+				'redirect'                => isset($params['redirect']) ? $params['redirect'] : null,
124
+				'device_type'             => isset($params['device_type']) ? $params['device_type'] : null
125
+			),
126
+			'body'  => (array)$body
127
+		));
128 128
 
129
-        return $response;
130
-    }
129
+		return $response;
130
+	}
131 131
     
132
-    public static function getOrder($params)
133
-    {
134
-        $query = array();
135
-        $allGetParameters = array('order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' );
132
+	public static function getOrder($params)
133
+	{
134
+		$query = array();
135
+		$allGetParameters = array('order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' );
136 136
         
137
-        foreach ($allGetParameters as $getParameter) {
138
-            if (isset($params->{$getParameter})) $query[$getParameter] = $params->{$getParameter};
139
-        }
137
+		foreach ($allGetParameters as $getParameter) {
138
+			if (isset($params->{$getParameter})) $query[$getParameter] = $params->{$getParameter};
139
+		}
140 140
 
141
-        $response = Route4Me::makeRequst(array(
142
-            'url'    => Endpoint::ORDER_V4,
143
-            'method' => 'GET',
144
-            'query'  => $query
145
-        ));
141
+		$response = Route4Me::makeRequst(array(
142
+			'url'    => Endpoint::ORDER_V4,
143
+			'method' => 'GET',
144
+			'query'  => $query
145
+		));
146 146
 
147
-        return $response;
148
-    }
147
+		return $response;
148
+	}
149 149
     
150
-    public static function getOrders($params)
151
-    {
152
-        $response = Route4Me::makeRequst(array(
153
-            'url'    => Endpoint::ORDER_V4,
154
-            'method' => 'GET',
155
-            'query'  => array(
156
-                'offset' => isset($params->offset) ? $params->offset : null,
157
-                'limit'  => isset($params->limit) ? $params->limit : null
158
-            )
159
-        ));
150
+	public static function getOrders($params)
151
+	{
152
+		$response = Route4Me::makeRequst(array(
153
+			'url'    => Endpoint::ORDER_V4,
154
+			'method' => 'GET',
155
+			'query'  => array(
156
+				'offset' => isset($params->offset) ? $params->offset : null,
157
+				'limit'  => isset($params->limit) ? $params->limit : null
158
+			)
159
+		));
160 160
 
161
-        return $response;
162
-    }
161
+		return $response;
162
+	}
163 163
     
164
-    public function getRandomOrderId($offset, $limit)
165
-    {
166
-        $randomOrder = $this->getRandomOrder($offset, $limit);
164
+	public function getRandomOrderId($offset, $limit)
165
+	{
166
+		$randomOrder = $this->getRandomOrder($offset, $limit);
167 167
         
168
-        if (is_null($randomOrder)) {
169
-            return null;
170
-        }
168
+		if (is_null($randomOrder)) {
169
+			return null;
170
+		}
171 171
         
172
-        if (!isset($randomOrder)) {
173
-            return null;
174
-        }
172
+		if (!isset($randomOrder)) {
173
+			return null;
174
+		}
175 175
         
176
-        return $randomOrder['order_id'];
177
-    }
176
+		return $randomOrder['order_id'];
177
+	}
178 178
     
179
-    public function getRandomOrder($offset, $limit)
180
-    {
181
-        $params = array('offset' => $offset, 'limit' => $limit);
179
+	public function getRandomOrder($offset, $limit)
180
+	{
181
+		$params = array('offset' => $offset, 'limit' => $limit);
182 182
         
183
-        $orders = self::getOrders($params);
183
+		$orders = self::getOrders($params);
184 184
         
185
-        if (is_null($orders)) {
186
-            return null;
187
-        }
185
+		if (is_null($orders)) {
186
+			return null;
187
+		}
188 188
         
189
-        if (!isset($orders['results'])) {
190
-            return null;
191
-        }
189
+		if (!isset($orders['results'])) {
190
+			return null;
191
+		}
192 192
         
193
-        $randomIndex = rand(0, sizeof($orders['results']) - 1);
193
+		$randomIndex = rand(0, sizeof($orders['results']) - 1);
194 194
         
195
-        $order = $orders['results'][$randomIndex];
195
+		$order = $orders['results'][$randomIndex];
196 196
         
197
-        return $order;
198
-    }
197
+		return $order;
198
+	}
199 199
     
200
-    public static function removeOrder($params)
201
-    {
202
-        $response = Route4Me::makeRequst(array(
203
-            'url'    => Endpoint::ORDER_V4,
204
-            'method' => 'DELETE',
205
-            'body'   => array(
206
-                'order_ids' =>  isset($params->order_ids) ? $params->order_ids : null
207
-            )
208
-        ));
200
+	public static function removeOrder($params)
201
+	{
202
+		$response = Route4Me::makeRequst(array(
203
+			'url'    => Endpoint::ORDER_V4,
204
+			'method' => 'DELETE',
205
+			'body'   => array(
206
+				'order_ids' =>  isset($params->order_ids) ? $params->order_ids : null
207
+			)
208
+		));
209 209
 
210
-        return $response;
211
-    }
210
+		return $response;
211
+	}
212 212
     
213
-    public static function updateOrder($body)
214
-    {
215
-        $response = Route4Me::makeRequst(array(
216
-            'url'    => Endpoint::ORDER_V4,
217
-            'method' => 'PUT',
218
-            'body'   => (array)$body
219
-        ));
213
+	public static function updateOrder($body)
214
+	{
215
+		$response = Route4Me::makeRequst(array(
216
+			'url'    => Endpoint::ORDER_V4,
217
+			'method' => 'PUT',
218
+			'body'   => (array)$body
219
+		));
220 220
 
221
-        return $response;
222
-    }
221
+		return $response;
222
+	}
223 223
     
224
-    public static function searchOrder($params)
225
-    {
226
-        $query = array();
227
-        $allSearchParameters = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' );
224
+	public static function searchOrder($params)
225
+	{
226
+		$query = array();
227
+		$allSearchParameters = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' );
228 228
         
229
-        foreach ($allSearchParameters as $searchParameter) {
230
-            if (isset($params->{$searchParameter})) $query[$searchParameter] = $params->{$searchParameter};
231
-        }
229
+		foreach ($allSearchParameters as $searchParameter) {
230
+			if (isset($params->{$searchParameter})) $query[$searchParameter] = $params->{$searchParameter};
231
+		}
232 232
         
233
-        $response = Route4Me::makeRequst(array(
234
-            'url'    => Endpoint::ORDER_V4,
235
-            'method' => 'GET',
236
-            'query'  => $query
237
-        ));
233
+		$response = Route4Me::makeRequst(array(
234
+			'url'    => Endpoint::ORDER_V4,
235
+			'method' => 'GET',
236
+			'query'  => $query
237
+		));
238 238
 
239
-        return $response;
240
-    }
239
+		return $response;
240
+	}
241 241
     
242
-    public static function validateLatitude($lat)
243
-    {
244
-        if (!is_numeric($lat)) {
245
-            return false;
246
-        }
242
+	public static function validateLatitude($lat)
243
+	{
244
+		if (!is_numeric($lat)) {
245
+			return false;
246
+		}
247 247
         
248
-        if ($lat>90 || $lat<-90) {
249
-            return false;
250
-        }
248
+		if ($lat>90 || $lat<-90) {
249
+			return false;
250
+		}
251 251
         
252
-        return true;
253
-    }
252
+		return true;
253
+	}
254 254
     
255
-    public static function validateLongitude($lng)
256
-    {
257
-        if (!is_numeric($lng)) {
258
-            return false;
259
-        }
255
+	public static function validateLongitude($lng)
256
+	{
257
+		if (!is_numeric($lng)) {
258
+			return false;
259
+		}
260 260
         
261
-        if ($lng>180 || $lng<-180) {
262
-            return false;
263
-        }
261
+		if ($lng>180 || $lng<-180) {
262
+			return false;
263
+		}
264 264
         
265
-        return true;
266
-    }
265
+		return true;
266
+	}
267 267
     
268
-    public function addOrdersFromCsvFile($csvFileHandle, $ordersFieldsMapping)
269
-    {
270
-        $max_line_length = 512;
271
-        $delemietr = ',';
268
+	public function addOrdersFromCsvFile($csvFileHandle, $ordersFieldsMapping)
269
+	{
270
+		$max_line_length = 512;
271
+		$delemietr = ',';
272 272
         
273
-        $results = array();
274
-        $results['fail'] = array();
275
-        $results['success'] = array();
273
+		$results = array();
274
+		$results['fail'] = array();
275
+		$results['success'] = array();
276 276
         
277
-        $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
277
+		$columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
278 278
         
279
-        $allOrderFields = array("curbside_lat","curbside_lng","color","day_scheduled_for_YYMMDD",
280
-                "address_alias","address_1","address_2","local_time_window_start","local_time_window_end","local_time_window_start_2",
281
-                "local_time_window_end_2","service_time","EXT_FIELD_first_name","EXT_FIELD_last_name","EXT_FIELD_email","EXT_FIELD_phone",
282
-                "EXT_FIELD_custom_data","order_icon");
279
+		$allOrderFields = array("curbside_lat","curbside_lng","color","day_scheduled_for_YYMMDD",
280
+				"address_alias","address_1","address_2","local_time_window_start","local_time_window_end","local_time_window_start_2",
281
+				"local_time_window_end_2","service_time","EXT_FIELD_first_name","EXT_FIELD_last_name","EXT_FIELD_email","EXT_FIELD_phone",
282
+				"EXT_FIELD_custom_data","order_icon");
283 283
         
284
-        if (!empty($columns)) {
285
-             array_push($results['fail'],'Empty CSV table');
286
-             return ($results);
287
-        }
284
+		if (!empty($columns)) {
285
+			 array_push($results['fail'],'Empty CSV table');
286
+			 return ($results);
287
+		}
288 288
                  
289
-        $iRow=1;
289
+		$iRow=1;
290 290
         
291
-        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
292
-            if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null)!==$rows) {
291
+		while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
292
+			if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null)!==$rows) {
293 293
                 
294
-                $cached_lat = 0.000;
294
+				$cached_lat = 0.000;
295 295
                 
296
-                if (!$this->validateLatitude($rows[$ordersFieldsMapping['cached_lat']])) {
297
-                    array_push($results['fail'], "$iRow --> Wrong cached_lat"); 
298
-                    $iRow++;
299
-                    continue;
300
-                } else {
301
-                    $cached_lat = doubleval($rows[$ordersFieldsMapping['cached_lat']]);
302
-                }
296
+				if (!$this->validateLatitude($rows[$ordersFieldsMapping['cached_lat']])) {
297
+					array_push($results['fail'], "$iRow --> Wrong cached_lat"); 
298
+					$iRow++;
299
+					continue;
300
+				} else {
301
+					$cached_lat = doubleval($rows[$ordersFieldsMapping['cached_lat']]);
302
+				}
303 303
                 
304
-                $cached_lng = 0.000;
304
+				$cached_lng = 0.000;
305 305
                 
306
-                if (!$this->validateLongitude($rows[$ordersFieldsMapping['cached_lng']])) {
307
-                    array_push($results['fail'], "$iRow --> Wrong cached_lng"); 
308
-                    $iRow++;
309
-                    continue;
310
-                } else {
311
-                    $cached_lng = doubleval($rows[$ordersFieldsMapping['cached_lng']]);
312
-                }
306
+				if (!$this->validateLongitude($rows[$ordersFieldsMapping['cached_lng']])) {
307
+					array_push($results['fail'], "$iRow --> Wrong cached_lng"); 
308
+					$iRow++;
309
+					continue;
310
+				} else {
311
+					$cached_lng = doubleval($rows[$ordersFieldsMapping['cached_lng']]);
312
+				}
313 313
                 
314
-                if (isset($ordersFieldsMapping['curbside_lat'])) {
315
-                    if (!$this->validateLatitude($rows[$ordersFieldsMapping['curbside_lat']])) {
316
-                        array_push($results['fail'], "$iRow --> Wrong curbside_lat"); 
317
-                        $iRow++;
318
-                        continue;
319
-                    }
320
-                }
314
+				if (isset($ordersFieldsMapping['curbside_lat'])) {
315
+					if (!$this->validateLatitude($rows[$ordersFieldsMapping['curbside_lat']])) {
316
+						array_push($results['fail'], "$iRow --> Wrong curbside_lat"); 
317
+						$iRow++;
318
+						continue;
319
+					}
320
+				}
321 321
                 
322
-                if (isset($ordersFieldsMapping['curbside_lng'])) {
323
-                    if (!$this->validateLongitude($rows[$ordersFieldsMapping['curbside_lng']])) {
324
-                        array_push($results['fail'], "$iRow --> Wrong curbside_lng"); 
325
-                        $iRow++;
326
-                        continue;
327
-                    }
328
-                }
322
+				if (isset($ordersFieldsMapping['curbside_lng'])) {
323
+					if (!$this->validateLongitude($rows[$ordersFieldsMapping['curbside_lng']])) {
324
+						array_push($results['fail'], "$iRow --> Wrong curbside_lng"); 
325
+						$iRow++;
326
+						continue;
327
+					}
328
+				}
329 329
                 
330
-                $address = $rows[$ordersFieldsMapping['address_1']];
330
+				$address = $rows[$ordersFieldsMapping['address_1']];
331 331
                 
332
-                if (isset($ordersFieldsMapping['order_city'])) {
333
-                    $address.=', '.$rows[$ordersFieldsMapping['order_city']];
334
-                }
332
+				if (isset($ordersFieldsMapping['order_city'])) {
333
+					$address.=', '.$rows[$ordersFieldsMapping['order_city']];
334
+				}
335 335
                 
336
-                if (isset($ordersFieldsMapping['order_state_id'])) {
337
-                    $address.=', '.$rows[$ordersFieldsMapping['order_state_id']];
338
-                }
336
+				if (isset($ordersFieldsMapping['order_state_id'])) {
337
+					$address.=', '.$rows[$ordersFieldsMapping['order_state_id']];
338
+				}
339 339
                 
340
-                if (isset($ordersFieldsMapping['order_zip_code'])) {
341
-                    $address.=', '.$rows[$ordersFieldsMapping['order_zip_code']];
342
-                }
340
+				if (isset($ordersFieldsMapping['order_zip_code'])) {
341
+					$address.=', '.$rows[$ordersFieldsMapping['order_zip_code']];
342
+				}
343 343
                 
344
-                if (isset($ordersFieldsMapping['order_country_id'])) {
345
-                    $address.=', '.$rows[$ordersFieldsMapping['order_country_id']];
346
-                }
344
+				if (isset($ordersFieldsMapping['order_country_id'])) {
345
+					$address.=', '.$rows[$ordersFieldsMapping['order_country_id']];
346
+				}
347 347
                 
348
-                echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].", ".$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']]."<br>";
348
+				echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].", ".$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']]."<br>";
349 349
                 
350
-                $parametersArray = array();
350
+				$parametersArray = array();
351 351
                 
352
-                $parametersArray["cached_lat"] = $cached_lat;
353
-                $parametersArray["cached_lng"] = $cached_lng;
352
+				$parametersArray["cached_lat"] = $cached_lat;
353
+				$parametersArray["cached_lng"] = $cached_lng;
354 354
                 
355 355
                 
356
-                foreach ($allOrderFields as $orderField) {
357
-                    if (isset($ordersFieldsMapping[$orderField])) {
358
-                        $parametersArray[$orderField] = $rows[$ordersFieldsMapping[$orderField]];
359
-                    }
360
-                }
356
+				foreach ($allOrderFields as $orderField) {
357
+					if (isset($ordersFieldsMapping[$orderField])) {
358
+						$parametersArray[$orderField] = $rows[$ordersFieldsMapping[$orderField]];
359
+					}
360
+				}
361 361
                 
362
-                $orderParameters = Order::fromArray($parametersArray);
362
+				$orderParameters = Order::fromArray($parametersArray);
363 363
 
364
-                $order = new Order();
364
+				$order = new Order();
365 365
                 
366
-                $orderResults = $order->addOrder($orderParameters);
366
+				$orderResults = $order->addOrder($orderParameters);
367 367
                 
368
-                array_push($results['success'], "The order with order_id = ".strval($orderResults["order_id"])." added successfuly.");
369
-            }
370
-            else {
371
-                array_push($results['fail'], "$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); 
372
-            }
368
+				array_push($results['success'], "The order with order_id = ".strval($orderResults["order_id"])." added successfuly.");
369
+			}
370
+			else {
371
+				array_push($results['fail'], "$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); 
372
+			}
373 373
             
374
-            $iRow++;
375
-        }
376
-    }
374
+			$iRow++;
375
+		}
376
+	}
377 377
 }
Please login to merge, or discard this patch.
src/Route4Me/AddressBookLocation.php 4 patches
Indentation   +427 added lines, -427 removed lines patch added patch discarded remove patch
@@ -6,510 +6,510 @@
 block discarded – undo
6 6
 
7 7
 class AddressBookLocation extends Common
8 8
 {
9
-    public $address_id;
10
-    public $address_group;
11
-    public $address_alias;
12
-    public $address_1;
13
-    public $address_2;
14
-    public $first_name;
15
-    public $last_name;
16
-    public $address_email;
17
-    public $address_phone_number;
18
-    public $address_city;
19
-    public $address_state_id;
20
-    public $address_country_id;
21
-    public $address_zip;
22
-    public $cached_lat;
23
-    public $cached_lng;
24
-    public $curbside_lat;
25
-    public $curbside_lng;
26
-    public $color;
27
-    public $address_custom_data;
28
-    public $schedule;
9
+	public $address_id;
10
+	public $address_group;
11
+	public $address_alias;
12
+	public $address_1;
13
+	public $address_2;
14
+	public $first_name;
15
+	public $last_name;
16
+	public $address_email;
17
+	public $address_phone_number;
18
+	public $address_city;
19
+	public $address_state_id;
20
+	public $address_country_id;
21
+	public $address_zip;
22
+	public $cached_lat;
23
+	public $cached_lng;
24
+	public $curbside_lat;
25
+	public $curbside_lng;
26
+	public $color;
27
+	public $address_custom_data;
28
+	public $schedule;
29 29
     
30
-    public $created_timestamp;
31
-    public $member_id;
32
-    public $schedule_blacklist;
33
-    public $in_route_count;
34
-    public $last_visited_timestamp;
35
-    public $last_routed_timestamp;
36
-    public $local_time_window_start;
37
-    public $local_time_window_end;
38
-    public $local_time_window_start_2;
39
-    public $local_time_window_end_2;
40
-    public $service_time;
41
-    public $local_timezone_string;
42
-    public $address_icon;
43
-    public $address_stop_type;
44
-    public $address_cube;
45
-    public $address_pieces;
46
-    public $address_reference_no;
47
-    public $address_revenue;
48
-    public $address_weight;
49
-    public $address_priority;
50
-    public $address_customer_po;
30
+	public $created_timestamp;
31
+	public $member_id;
32
+	public $schedule_blacklist;
33
+	public $in_route_count;
34
+	public $last_visited_timestamp;
35
+	public $last_routed_timestamp;
36
+	public $local_time_window_start;
37
+	public $local_time_window_end;
38
+	public $local_time_window_start_2;
39
+	public $local_time_window_end_2;
40
+	public $service_time;
41
+	public $local_timezone_string;
42
+	public $address_icon;
43
+	public $address_stop_type;
44
+	public $address_cube;
45
+	public $address_pieces;
46
+	public $address_reference_no;
47
+	public $address_revenue;
48
+	public $address_weight;
49
+	public $address_priority;
50
+	public $address_customer_po;
51 51
     
52
-    public static function fromArray(array $params)
53
-    {
54
-        $addressbooklocation = new AddressBookLocation();
52
+	public static function fromArray(array $params)
53
+	{
54
+		$addressbooklocation = new AddressBookLocation();
55 55
         
56
-        foreach ($params as $key => $value) {
57
-            if (property_exists($addressbooklocation, $key)) {
58
-                $addressbooklocation->{$key} = $value;
59
-            }
60
-        }
56
+		foreach ($params as $key => $value) {
57
+			if (property_exists($addressbooklocation, $key)) {
58
+				$addressbooklocation->{$key} = $value;
59
+			}
60
+		}
61 61
         
62
-        return $addressbooklocation;
63
-    }
62
+		return $addressbooklocation;
63
+	}
64 64
     
65
-    public static function getAddressBookLocation($addressId)
66
-    {
67
-        $ablocations = Route4Me::makeRequst(array(
68
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
69
-            'method' => 'GET',
70
-            'query'  => array(
71
-                'query' => $addressId,
72
-                'limit' => 30
73
-            )
74
-        ));
65
+	public static function getAddressBookLocation($addressId)
66
+	{
67
+		$ablocations = Route4Me::makeRequst(array(
68
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
69
+			'method' => 'GET',
70
+			'query'  => array(
71
+				'query' => $addressId,
72
+				'limit' => 30
73
+			)
74
+		));
75 75
 
76
-        return $ablocations;
77
-    }
76
+		return $ablocations;
77
+	}
78 78
     
79
-    public static function searchRoutedLocation($params)
80
-    {
81
-        $result = Route4Me::makeRequst(array(
82
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
83
-            'method' => 'GET',
84
-            'query'  => array(
85
-                'display' => isset($params['display']) ? $params['display'] : null,
86
-                'query'   => isset($params['query']) ? $params['query'] : null,
87
-                'fields'  => isset($params['fields']) ? $params['fields'] : null,
88
-                'limit'   => isset($params['limit']) ? $params['limit'] : null,
89
-                'offset'  => isset($params['offset']) ? $params['offset'] : null,
90
-            )
91
-        ));
79
+	public static function searchRoutedLocation($params)
80
+	{
81
+		$result = Route4Me::makeRequst(array(
82
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
83
+			'method' => 'GET',
84
+			'query'  => array(
85
+				'display' => isset($params['display']) ? $params['display'] : null,
86
+				'query'   => isset($params['query']) ? $params['query'] : null,
87
+				'fields'  => isset($params['fields']) ? $params['fields'] : null,
88
+				'limit'   => isset($params['limit']) ? $params['limit'] : null,
89
+				'offset'  => isset($params['offset']) ? $params['offset'] : null,
90
+			)
91
+		));
92 92
 
93
-        return $result;
94
-    }
93
+		return $result;
94
+	}
95 95
     
96
-    public static function getAddressBookLocations($params)
97
-    {
98
-        $ablocations = Route4Me::makeRequst(array(
99
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
100
-            'method' => 'GET',
101
-            'query'  => array(
102
-                'limit'  => isset($params['limit']) ? $params['limit'] : null,
103
-                'offset' => isset($params['offset']) ? $params['offset'] : null,
104
-            )
105
-        ));
96
+	public static function getAddressBookLocations($params)
97
+	{
98
+		$ablocations = Route4Me::makeRequst(array(
99
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
100
+			'method' => 'GET',
101
+			'query'  => array(
102
+				'limit'  => isset($params['limit']) ? $params['limit'] : null,
103
+				'offset' => isset($params['offset']) ? $params['offset'] : null,
104
+			)
105
+		));
106 106
 
107
-        return $ablocations;
108
-    }
107
+		return $ablocations;
108
+	}
109 109
     
110
-    public static function getAddressBookLocationsByIDs($ids)
111
-    {
112
-        $ablocations = Route4Me::makeRequst(array(
113
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
114
-            'method' => 'GET',
115
-            'query'  => array(
116
-                'address_id' => $ids
117
-            )
118
-        ));
110
+	public static function getAddressBookLocationsByIDs($ids)
111
+	{
112
+		$ablocations = Route4Me::makeRequst(array(
113
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
114
+			'method' => 'GET',
115
+			'query'  => array(
116
+				'address_id' => $ids
117
+			)
118
+		));
119 119
 
120
-        return $ablocations;
121
-    }
120
+		return $ablocations;
121
+	}
122 122
     
123
-    public static function getRandomAddressBookLocation($params)
124
-    {
125
-        $ablocations = Route4Me::makeRequst(array(
126
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
127
-            'method' => 'GET',
128
-            'query'  => array(
129
-                'limit'  => isset($params['limit']) ? $params['limit'] : 0,
130
-                'offset' => isset($params['offset']) ? $params['offset'] : 10,
131
-            )
132
-        ));
123
+	public static function getRandomAddressBookLocation($params)
124
+	{
125
+		$ablocations = Route4Me::makeRequst(array(
126
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
127
+			'method' => 'GET',
128
+			'query'  => array(
129
+				'limit'  => isset($params['limit']) ? $params['limit'] : 0,
130
+				'offset' => isset($params['offset']) ? $params['offset'] : 10,
131
+			)
132
+		));
133 133
         
134
-        if (isset($ablocations["results"])) {
135
-            $locationsSize = sizeof($ablocations["results"]);
134
+		if (isset($ablocations["results"])) {
135
+			$locationsSize = sizeof($ablocations["results"]);
136 136
             
137
-            if ($locationsSize>0) {
138
-                $randomLocationIndex = rand(0, $locationsSize - 1);
139
-                return $ablocations["results"][$randomLocationIndex];
140
-            } 
141
-        } 
137
+			if ($locationsSize>0) {
138
+				$randomLocationIndex = rand(0, $locationsSize - 1);
139
+				return $ablocations["results"][$randomLocationIndex];
140
+			} 
141
+		} 
142 142
 
143
-        return null;
144
-    }
143
+		return null;
144
+	}
145 145
     
146
-    /**
147
-     * @param AddressBookLocation $params
148
-    */
149
-    public static function addAdressBookLocation($params)
150
-    {
151
-        $body = array();
152
-        $abLocations = new AddressBookLocation();
146
+	/**
147
+	 * @param AddressBookLocation $params
148
+	 */
149
+	public static function addAdressBookLocation($params)
150
+	{
151
+		$body = array();
152
+		$abLocations = new AddressBookLocation();
153 153
         
154
-        foreach ($params as $key => $value) {
155
-            if ($key=="address_id") {
156
-                continue;
157
-            }
154
+		foreach ($params as $key => $value) {
155
+			if ($key=="address_id") {
156
+				continue;
157
+			}
158 158
             
159
-            if (property_exists($abLocations, $key)) {
160
-                if (isset($params->{$key})) {
161
-                    $body[$key] = $params->{$key};
162
-                } 
163
-            }
164
-        }
159
+			if (property_exists($abLocations, $key)) {
160
+				if (isset($params->{$key})) {
161
+					$body[$key] = $params->{$key};
162
+				} 
163
+			}
164
+		}
165 165
         
166
-        $response = Route4Me::makeRequst(array(
167
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
168
-            'method' => 'POST',
169
-            'body'   => $body
170
-        ));
166
+		$response = Route4Me::makeRequst(array(
167
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
168
+			'method' => 'POST',
169
+			'body'   => $body
170
+		));
171 171
 
172
-        return $response;
173
-    }
172
+		return $response;
173
+	}
174 174
     
175
-    public function deleteAdressBookLocation($address_ids)
176
-    {
177
-        $result = Route4Me::makeRequst(array(
178
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
179
-            'method' => 'DELETEARRAY',
180
-            'query'  => array(
181
-                'address_ids' => $address_ids
182
-            )
183
-        ));
175
+	public function deleteAdressBookLocation($address_ids)
176
+	{
177
+		$result = Route4Me::makeRequst(array(
178
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
179
+			'method' => 'DELETEARRAY',
180
+			'query'  => array(
181
+				'address_ids' => $address_ids
182
+			)
183
+		));
184 184
 
185
-        return $result;
186
-    }
185
+		return $result;
186
+	}
187 187
     
188
-    public function updateAdressBookLocation($params)
189
-    {
190
-        $body = array();
191
-        $abLocations = new AddressBookLocation();
188
+	public function updateAdressBookLocation($params)
189
+	{
190
+		$body = array();
191
+		$abLocations = new AddressBookLocation();
192 192
         
193
-        foreach ($params as $key => $value) {
194
-            if (property_exists($abLocations, $key)) {
195
-                if (isset($params->{$key})) {
196
-                    $body[$key] = $params->{$key};
197
-                } 
198
-            }
199
-        }
193
+		foreach ($params as $key => $value) {
194
+			if (property_exists($abLocations, $key)) {
195
+				if (isset($params->{$key})) {
196
+					$body[$key] = $params->{$key};
197
+				} 
198
+			}
199
+		}
200 200
 
201
-        $response = Route4Me::makeRequst(array(
202
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
203
-            'method' => 'PUT',
204
-            'body'   => $body,
205
-        ));
201
+		$response = Route4Me::makeRequst(array(
202
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
203
+			'method' => 'PUT',
204
+			'body'   => $body,
205
+		));
206 206
 
207
-        return $response;
208
-    }
207
+		return $response;
208
+	}
209 209
         
210
-    public static function get($params)
211
-    {
212
-        $ablocations = Route4Me::makeRequst(array(
213
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
214
-            'method' => 'ADD',
215
-            'query'  => array(
216
-                'first_name' => isset($params->first_name) ? $params->first_name : null,
217
-                'address_1'  => isset($params->address_1) ? $params->address_1 : null,
218
-                'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
219
-                'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
220
-            )
221
-        ));
210
+	public static function get($params)
211
+	{
212
+		$ablocations = Route4Me::makeRequst(array(
213
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
214
+			'method' => 'ADD',
215
+			'query'  => array(
216
+				'first_name' => isset($params->first_name) ? $params->first_name : null,
217
+				'address_1'  => isset($params->address_1) ? $params->address_1 : null,
218
+				'cached_lat' => isset($params->cached_lat) ? $params->cached_lat : null,
219
+				'cached_lng' => isset($params->cached_lng) ? $params->cached_lng : null,
220
+			)
221
+		));
222 222
 
223
-        return $ablocations;
224
-    }
223
+		return $ablocations;
224
+	}
225 225
     
226
-    public static function validateScheduleMode($scheduleMode)
227
-    {
228
-        $schedMmodes = array("daily", "weekly", "monthly", "annually");
226
+	public static function validateScheduleMode($scheduleMode)
227
+	{
228
+		$schedMmodes = array("daily", "weekly", "monthly", "annually");
229 229
         
230
-        if (in_array($scheduleMode, $schedMmodes)) {
231
-            return TRUE; 
232
-        } else {
233
-            return FALSE;
234
-        }
235
-    }
230
+		if (in_array($scheduleMode, $schedMmodes)) {
231
+			return TRUE; 
232
+		} else {
233
+			return FALSE;
234
+		}
235
+	}
236 236
     
237
-    public static function validateScheduleEnable($scheduleEnabled)
238
-    {
239
-        $schedEnables = array(TRUE, FALSE);
237
+	public static function validateScheduleEnable($scheduleEnabled)
238
+	{
239
+		$schedEnables = array(TRUE, FALSE);
240 240
         
241
-        if (in_array($scheduleEnabled, $schedEnables)) {
242
-            return TRUE;
243
-        } else {
244
-            return FALSE;
245
-        }
246
-    }
241
+		if (in_array($scheduleEnabled, $schedEnables)) {
242
+			return TRUE;
243
+		} else {
244
+			return FALSE;
245
+		}
246
+	}
247 247
     
248
-    public static function validateScheduleEvery($scheduleEvery)
249
-    {
250
-        if (is_numeric($scheduleEvery)) {
251
-            return TRUE;
252
-        } else {
253
-            return FALSE;
254
-        }
255
-    }
248
+	public static function validateScheduleEvery($scheduleEvery)
249
+	{
250
+		if (is_numeric($scheduleEvery)) {
251
+			return TRUE;
252
+		} else {
253
+			return FALSE;
254
+		}
255
+	}
256 256
     
257
-    public static function validateScheduleWeekDays($scheduleWeekDays)
258
-    {
259
-        $weekdays = explode(',', $scheduleWeekDays);
257
+	public static function validateScheduleWeekDays($scheduleWeekDays)
258
+	{
259
+		$weekdays = explode(',', $scheduleWeekDays);
260 260
         
261
-        if (sizeof($weekdays)<1) return FALSE;
261
+		if (sizeof($weekdays)<1) return FALSE;
262 262
         
263
-        $isValid = TRUE;
263
+		$isValid = TRUE;
264 264
         
265
-        for ($i=0; $i<sizeof($weekdays); $i++) { 
266
-            if (is_numeric($weekdays[$i])) {
267
-                $wday = intval($weekdays[$i]);
268
-                if ($wday<1 || $wday>7) $isValid = FALSE;
269
-            } else {
270
-                $isValid = FALSE;
271
-            }
272
-        }
265
+		for ($i=0; $i<sizeof($weekdays); $i++) { 
266
+			if (is_numeric($weekdays[$i])) {
267
+				$wday = intval($weekdays[$i]);
268
+				if ($wday<1 || $wday>7) $isValid = FALSE;
269
+			} else {
270
+				$isValid = FALSE;
271
+			}
272
+		}
273 273
         
274
-        return $isValid;
275
-    }
274
+		return $isValid;
275
+	}
276 276
     
277
-    public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
278
-    {
279
-        $schedMonthlyMmodes = array("dates", "nth");
277
+	public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
278
+	{
279
+		$schedMonthlyMmodes = array("dates", "nth");
280 280
         
281
-        if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) {
282
-            return TRUE;
283
-        } else {
284
-            return FALSE;
285
-        }
286
-    }
281
+		if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) {
282
+			return TRUE;
283
+		} else {
284
+			return FALSE;
285
+		}
286
+	}
287 287
     
288
-    public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
289
-    {
290
-        $monthlyDates = explode(',', $scheduleMonthlyDates);
288
+	public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
289
+	{
290
+		$monthlyDates = explode(',', $scheduleMonthlyDates);
291 291
         
292
-        if (sizeof($monthlyDates) <1) return FALSE;
292
+		if (sizeof($monthlyDates) <1) return FALSE;
293 293
         
294
-        $isValid = TRUE;
294
+		$isValid = TRUE;
295 295
         
296
-        for ($i=0; $i < sizeof($monthlyDates); $i++) { 
297
-            if (is_numeric($monthlyDates[$i])) {
298
-                $mday = intval($monthlyDates[$i]);
299
-                if ($mday <1 || $mday > 31) $isValid = FALSE;
300
-            } else {
301
-                $isValid = FALSE;
302
-            }
303
-        }
296
+		for ($i=0; $i < sizeof($monthlyDates); $i++) { 
297
+			if (is_numeric($monthlyDates[$i])) {
298
+				$mday = intval($monthlyDates[$i]);
299
+				if ($mday <1 || $mday > 31) $isValid = FALSE;
300
+			} else {
301
+				$isValid = FALSE;
302
+			}
303
+		}
304 304
 
305
-        return $isValid;
306
-    }
305
+		return $isValid;
306
+	}
307 307
     
308
-    public static function validateScheduleNthN($scheduleNthN)
309
-    {
310
-        if (!is_numeric($scheduleNthN)) return FALSE;
308
+	public static function validateScheduleNthN($scheduleNthN)
309
+	{
310
+		if (!is_numeric($scheduleNthN)) return FALSE;
311 311
         
312
-        $schedNthNs = array(1, 2, 3, 4, 5, -1);
312
+		$schedNthNs = array(1, 2, 3, 4, 5, -1);
313 313
         
314
-        if (in_array($scheduleNthN, $schedNthNs)) {
315
-            return TRUE;
316
-        } else {
317
-            return FALSE;
318
-        }
319
-    }
314
+		if (in_array($scheduleNthN, $schedNthNs)) {
315
+			return TRUE;
316
+		} else {
317
+			return FALSE;
318
+		}
319
+	}
320 320
     
321
-    public static function validateScheduleNthWhat($scheduleNthWhat)
322
-    {
323
-        if (!is_numeric($scheduleNthWhat)) return FALSE;
321
+	public static function validateScheduleNthWhat($scheduleNthWhat)
322
+	{
323
+		if (!is_numeric($scheduleNthWhat)) return FALSE;
324 324
         
325
-        $schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
325
+		$schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
326 326
         
327
-        if (in_array($scheduleNthWhat, $schedNthWhats)) {
328
-            return TRUE;
329
-        } else {
330
-            return FALSE;
331
-        }
332
-    }
327
+		if (in_array($scheduleNthWhat, $schedNthWhats)) {
328
+			return TRUE;
329
+		} else {
330
+			return FALSE;
331
+		}
332
+	}
333 333
     
334
-    /* Function adds the locations (with/without schedule) from the CSV file. 
334
+	/* Function adds the locations (with/without schedule) from the CSV file. 
335 335
      * $csvFileHandle - a file handler.
336 336
      * Returns array $results which contains two arrays: fail and succes.
337 337
      */
338
-    public function addLocationsFromCsvFile($csvFileHandle, $locationsFieldsMapping)
339
-    {
340
-        $max_line_length = 512;
341
-        $delemietr = ',';
338
+	public function addLocationsFromCsvFile($csvFileHandle, $locationsFieldsMapping)
339
+	{
340
+		$max_line_length = 512;
341
+		$delemietr = ',';
342 342
         
343
-        $results = array();
344
-        $results['fail'] = array();
345
-        $results['success'] = array();
343
+		$results = array();
344
+		$results['fail'] = array();
345
+		$results['success'] = array();
346 346
         
347
-        $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
347
+		$columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
348 348
         
349
-        $addressBookFields = array("cached_lat","cached_lng","curbside_lat","curbside_lng","address_alias","address_1","address_2","address_city",
350
-                "address_state_id","address_zip","address_phone_number","schedule","address_group","first_name","last_name","local_time_window_start",
351
-                "local_time_window_end","local_time_window_start_2","local_time_window_end_2","address_email","address_country_id","address_custom_data",
352
-                "schedule_blacklist","service_time","local_timezone_string","color","address_icon","address_stop_type","address_cube","address_pieces",
353
-                "address_reference_no","address_revenue","address_weight","address_priority","address_customer_po");
349
+		$addressBookFields = array("cached_lat","cached_lng","curbside_lat","curbside_lng","address_alias","address_1","address_2","address_city",
350
+				"address_state_id","address_zip","address_phone_number","schedule","address_group","first_name","last_name","local_time_window_start",
351
+				"local_time_window_end","local_time_window_start_2","local_time_window_end_2","address_email","address_country_id","address_custom_data",
352
+				"schedule_blacklist","service_time","local_timezone_string","color","address_icon","address_stop_type","address_cube","address_pieces",
353
+				"address_reference_no","address_revenue","address_weight","address_priority","address_customer_po");
354 354
 
355
-        if (empty($columns)) {
356
-            array_push($results['fail'], 'Empty CSV table');
357
-            return ($results);
358
-        }
355
+		if (empty($columns)) {
356
+			array_push($results['fail'], 'Empty CSV table');
357
+			return ($results);
358
+		}
359 359
 
360
-        $iRow = 1;
360
+		$iRow = 1;
361 361
         
362
-        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) {
363
-            if ($rows[$locationsFieldsMapping['cached_lat']] 
364
-                  && $rows[$locationsFieldsMapping['cached_lng']] 
365
-                  && $rows[$locationsFieldsMapping['address_1']] 
366
-                  && array(null)!==$rows) {
367
-                $curSchedule = "";
368
-                $mode = "";
362
+		while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) {
363
+			if ($rows[$locationsFieldsMapping['cached_lat']] 
364
+				  && $rows[$locationsFieldsMapping['cached_lng']] 
365
+				  && $rows[$locationsFieldsMapping['address_1']] 
366
+				  && array(null)!==$rows) {
367
+				$curSchedule = "";
368
+				$mode = "";
369 369
                 
370
-                if (isset($rows[$locationsFieldsMapping['schedule_mode']])) {
371
-                    if ($this->validateScheduleMode($rows[$locationsFieldsMapping['schedule_mode']])) {
372
-                        $curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; 
373
-                        $mode = $rows[$locationsFieldsMapping['schedule_mode']];
374
-                    } else {
375
-                        array_push($results['fail'], "$iRow --> Wrong schedule mode parameter"); 
376
-                        $curSchedule = "";
377
-                    }
378
-                } else {
379
-                    array_push($results['fail'], "$iRow --> The schedule mode parameter is not set"); 
380
-                    $curSchedule = "";
381
-                }
370
+				if (isset($rows[$locationsFieldsMapping['schedule_mode']])) {
371
+					if ($this->validateScheduleMode($rows[$locationsFieldsMapping['schedule_mode']])) {
372
+						$curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; 
373
+						$mode = $rows[$locationsFieldsMapping['schedule_mode']];
374
+					} else {
375
+						array_push($results['fail'], "$iRow --> Wrong schedule mode parameter"); 
376
+						$curSchedule = "";
377
+					}
378
+				} else {
379
+					array_push($results['fail'], "$iRow --> The schedule mode parameter is not set"); 
380
+					$curSchedule = "";
381
+				}
382 382
                 
383
-                if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) {
384
-                    if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { 
385
-                        $curSchedule .= '"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].',';
386
-                    } else {
387
-                        array_push($results['fail'], "$iRow --> The schedule enabled parameter is not set ");  
388
-                        $curSchedule = "";
389
-                    }
390
-                }
383
+				if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) {
384
+					if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { 
385
+						$curSchedule .= '"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].',';
386
+					} else {
387
+						array_push($results['fail'], "$iRow --> The schedule enabled parameter is not set ");  
388
+						$curSchedule = "";
389
+					}
390
+				}
391 391
                 
392
-                if (isset($rows[$locationsFieldsMapping['schedule_every']])) {
393
-                    if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) {
394
-                        $curSchedule.='"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
395
-                        if ($mode == 'daily') {
396
-                            $curSchedule = trim($curSchedule,',');
397
-                            $curSchedule.='}';
398
-                        }
399
-                    } else {
400
-                        array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); 
401
-                        $curSchedule = ""; 
402
-                    }
403
-                }
392
+				if (isset($rows[$locationsFieldsMapping['schedule_every']])) {
393
+					if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) {
394
+						$curSchedule.='"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
395
+						if ($mode == 'daily') {
396
+							$curSchedule = trim($curSchedule,',');
397
+							$curSchedule.='}';
398
+						}
399
+					} else {
400
+						array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); 
401
+						$curSchedule = ""; 
402
+					}
403
+				}
404 404
                 
405
-                if ($mode!='daily') {
406
-                    switch ($mode) {
407
-                        case 'weekly':
408
-                            if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
409
-                                if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
410
-                                     $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
411
-                                } else {
412
-                                    array_push($results['fail'], "$iRow --> Wrong weekdays"); 
413
-                                    $curSchedule = "";
414
-                                }
415
-                            } else {
416
-                                array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
417
-                                $curSchedule = "";
418
-                            }
419
-                            break;
420
-                        case 'monthly':
421
-                            $monthlyMode = "";
422
-                            if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
423
-                                if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
424
-                                     $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
425
-                                     $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
426
-                                } else {
427
-                                    array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
428
-                                    $curSchedule = "";
429
-                                }
430
-                            } else {
431
-                                array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
432
-                                $curSchedule = "";
433
-                            }
405
+				if ($mode!='daily') {
406
+					switch ($mode) {
407
+						case 'weekly':
408
+							if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
409
+								if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
410
+									 $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
411
+								} else {
412
+									array_push($results['fail'], "$iRow --> Wrong weekdays"); 
413
+									$curSchedule = "";
414
+								}
415
+							} else {
416
+								array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
417
+								$curSchedule = "";
418
+							}
419
+							break;
420
+						case 'monthly':
421
+							$monthlyMode = "";
422
+							if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
423
+								if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
424
+									 $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
425
+									 $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
426
+								} else {
427
+									array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
428
+									$curSchedule = "";
429
+								}
430
+							} else {
431
+								array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
432
+								$curSchedule = "";
433
+							}
434 434
                             
435
-                            if ($monthlyMode != "") {
436
-                                switch ($monthlyMode) {
437
-                                    case 'dates':
438
-                                        if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
439
-                                            if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
440
-                                                 $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
441
-                                            } else {
442
-                                                array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
443
-                                                $curSchedule = "";
444
-                                            }
445
-                                        }
446
-                                        break;
447
-                                    case 'nth':
448
-                                        if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
449
-                                            if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
450
-                                                 $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
451
-                                            } else {
452
-                                                array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
453
-                                                $curSchedule = "";
454
-                                            }
455
-                                        } else {
456
-                                            array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
457
-                                            $curSchedule = "";
458
-                                        }
435
+							if ($monthlyMode != "") {
436
+								switch ($monthlyMode) {
437
+									case 'dates':
438
+										if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
439
+											if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
440
+												 $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
441
+											} else {
442
+												array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
443
+												$curSchedule = "";
444
+											}
445
+										}
446
+										break;
447
+									case 'nth':
448
+										if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
449
+											if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
450
+												 $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
451
+											} else {
452
+												array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
453
+												$curSchedule = "";
454
+											}
455
+										} else {
456
+											array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
457
+											$curSchedule = "";
458
+										}
459 459
                                         
460
-                                        if ($curSchedule != "") {
461
-                                            if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
462
-                                                if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
463
-                                                     $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
464
-                                                } else {
465
-                                                    array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
466
-                                                    $curSchedule = "";
467
-                                                }
468
-                                            } else {
469
-                                                array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
470
-                                                $curSchedule = "";
471
-                                            }
472
-                                        }
473
-                                        break;
474
-                                }
475
-                            }
476
-                            break;
477
-                        default:
478
-                            $curSchedule = "";
479
-                            break;
480
-                    }
481
-                }
460
+										if ($curSchedule != "") {
461
+											if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
462
+												if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
463
+													 $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
464
+												} else {
465
+													array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
466
+													$curSchedule = "";
467
+												}
468
+											} else {
469
+												array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
470
+												$curSchedule = "";
471
+											}
472
+										}
473
+										break;
474
+								}
475
+							}
476
+							break;
477
+						default:
478
+							$curSchedule = "";
479
+							break;
480
+					}
481
+				}
482 482
 
483
-                if (($mode == 'daily' || $mode == 'weekly' || $mode == 'monthy') && $curSchedule == "") {
484
-                    $iRow++; 
485
-                    continue;
486
-                }
483
+				if (($mode == 'daily' || $mode == 'weekly' || $mode == 'monthy') && $curSchedule == "") {
484
+					$iRow++; 
485
+					continue;
486
+				}
487 487
                 
488
-                $curSchedule = strtolower($curSchedule);
488
+				$curSchedule = strtolower($curSchedule);
489 489
                 
490
-                $curSchedule = '[{'.$curSchedule.'}]';
490
+				$curSchedule = '[{'.$curSchedule.'}]';
491 491
 
492
-                $oSchedule = json_decode($curSchedule,TRUE);
492
+				$oSchedule = json_decode($curSchedule,TRUE);
493 493
                 
494
-                $parametersArray = array();
494
+				$parametersArray = array();
495 495
                 
496
-                foreach ($addressBookFields as $addressBookField) {
497
-                    if (isset($locationsFieldsMapping[$addressBookField])) {
498
-                        $parametersArray[$addressBookField] = $rows[$locationsFieldsMapping[$addressBookField]];
499
-                    }
500
-                }
496
+				foreach ($addressBookFields as $addressBookField) {
497
+					if (isset($locationsFieldsMapping[$addressBookField])) {
498
+						$parametersArray[$addressBookField] = $rows[$locationsFieldsMapping[$addressBookField]];
499
+					}
500
+				}
501 501
                 
502
-                $AdressBookLocationParameters = AddressBookLocation::fromArray($parametersArray);
502
+				$AdressBookLocationParameters = AddressBookLocation::fromArray($parametersArray);
503 503
                 
504
-                $abContacts = new AddressBookLocation();
504
+				$abContacts = new AddressBookLocation();
505 505
 
506
-                $abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
506
+				$abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
507 507
                 
508
-                array_push($results['success'], "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly.");
509
-            }
510
-        }
508
+				array_push($results['success'], "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly.");
509
+			}
510
+		}
511 511
 
512
-        return $results;
513
-    }
512
+		return $results;
513
+	}
514 514
  }
515
-    
516 515
\ No newline at end of file
516
+	
517 517
\ No newline at end of file
Please login to merge, or discard this patch.
Switch Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -404,79 +404,79 @@
 block discarded – undo
404 404
                 
405 405
                 if ($mode!='daily') {
406 406
                     switch ($mode) {
407
-                        case 'weekly':
408
-                            if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
409
-                                if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
410
-                                     $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
411
-                                } else {
412
-                                    array_push($results['fail'], "$iRow --> Wrong weekdays"); 
413
-                                    $curSchedule = "";
414
-                                }
407
+                    case 'weekly':
408
+                        if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
409
+                            if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
410
+                                 $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
411
+                            } else {
412
+                                array_push($results['fail'], "$iRow --> Wrong weekdays"); 
413
+                                $curSchedule = "";
414
+                            }
415
+                        } else {
416
+                            array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
417
+                            $curSchedule = "";
418
+                        }
419
+                        break;
420
+                    case 'monthly':
421
+                        $monthlyMode = "";
422
+                        if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
423
+                            if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
424
+                                 $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
425
+                                 $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
415 426
                             } else {
416
-                                array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
427
+                                array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
417 428
                                 $curSchedule = "";
418 429
                             }
430
+                        } else {
431
+                            array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
432
+                            $curSchedule = "";
433
+                        }
434
+                            
435
+                        if ($monthlyMode != "") {
436
+                            switch ($monthlyMode) {
437
+                            case 'dates':
438
+                            if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
439
+                            if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
440
+                                 $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
441
+                            } else {
442
+                                array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
443
+                                $curSchedule = "";
444
+                            }
445
+                            }
419 446
                             break;
420
-                        case 'monthly':
421
-                            $monthlyMode = "";
422
-                            if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
423
-                                if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
424
-                                     $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
425
-                                     $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
447
+                            case 'nth':
448
+                            if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
449
+                            if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
450
+                                 $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
451
+                            } else {
452
+                                array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
453
+                                $curSchedule = "";
454
+                            }
455
+                            } else {
456
+                            array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
457
+                            $curSchedule = "";
458
+                            }
459
+                                        
460
+                            if ($curSchedule != "") {
461
+                            if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
462
+                                if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
463
+                                     $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
426 464
                                 } else {
427
-                                    array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
465
+                                    array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
428 466
                                     $curSchedule = "";
429 467
                                 }
430 468
                             } else {
431
-                                array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
469
+                                array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
432 470
                                 $curSchedule = "";
433 471
                             }
434
-                            
435
-                            if ($monthlyMode != "") {
436
-                                switch ($monthlyMode) {
437
-                                    case 'dates':
438
-                                        if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
439
-                                            if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
440
-                                                 $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
441
-                                            } else {
442
-                                                array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
443
-                                                $curSchedule = "";
444
-                                            }
445
-                                        }
446
-                                        break;
447
-                                    case 'nth':
448
-                                        if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
449
-                                            if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
450
-                                                 $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
451
-                                            } else {
452
-                                                array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
453
-                                                $curSchedule = "";
454
-                                            }
455
-                                        } else {
456
-                                            array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
457
-                                            $curSchedule = "";
458
-                                        }
459
-                                        
460
-                                        if ($curSchedule != "") {
461
-                                            if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
462
-                                                if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
463
-                                                     $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
464
-                                                } else {
465
-                                                    array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
466
-                                                    $curSchedule = "";
467
-                                                }
468
-                                            } else {
469
-                                                array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
470
-                                                $curSchedule = "";
471
-                                            }
472
-                                        }
473
-                                        break;
474
-                                }
475 472
                             }
476 473
                             break;
477
-                        default:
478
-                            $curSchedule = "";
474
+                            }
475
+                            }
479 476
                             break;
477
+                    default:
478
+                        $curSchedule = "";
479
+                        break;
480 480
                     }
481 481
                 }
482 482
 
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         
263 263
         $isValid = TRUE;
264 264
         
265
-        for ($i=0; $i<sizeof($weekdays); $i++) { 
265
+        for ($i = 0; $i<sizeof($weekdays); $i++) { 
266 266
             if (is_numeric($weekdays[$i])) {
267 267
                 $wday = intval($weekdays[$i]);
268 268
                 if ($wday<1 || $wday>7) $isValid = FALSE;
@@ -289,14 +289,14 @@  discard block
 block discarded – undo
289 289
     {
290 290
         $monthlyDates = explode(',', $scheduleMonthlyDates);
291 291
         
292
-        if (sizeof($monthlyDates) <1) return FALSE;
292
+        if (sizeof($monthlyDates)<1) return FALSE;
293 293
         
294 294
         $isValid = TRUE;
295 295
         
296
-        for ($i=0; $i < sizeof($monthlyDates); $i++) { 
296
+        for ($i = 0; $i<sizeof($monthlyDates); $i++) { 
297 297
             if (is_numeric($monthlyDates[$i])) {
298 298
                 $mday = intval($monthlyDates[$i]);
299
-                if ($mday <1 || $mday > 31) $isValid = FALSE;
299
+                if ($mday<1 || $mday>31) $isValid = FALSE;
300 300
             } else {
301 301
                 $isValid = FALSE;
302 302
             }
@@ -346,11 +346,11 @@  discard block
 block discarded – undo
346 346
         
347 347
         $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
348 348
         
349
-        $addressBookFields = array("cached_lat","cached_lng","curbside_lat","curbside_lng","address_alias","address_1","address_2","address_city",
350
-                "address_state_id","address_zip","address_phone_number","schedule","address_group","first_name","last_name","local_time_window_start",
351
-                "local_time_window_end","local_time_window_start_2","local_time_window_end_2","address_email","address_country_id","address_custom_data",
352
-                "schedule_blacklist","service_time","local_timezone_string","color","address_icon","address_stop_type","address_cube","address_pieces",
353
-                "address_reference_no","address_revenue","address_weight","address_priority","address_customer_po");
349
+        $addressBookFields = array("cached_lat", "cached_lng", "curbside_lat", "curbside_lng", "address_alias", "address_1", "address_2", "address_city",
350
+                "address_state_id", "address_zip", "address_phone_number", "schedule", "address_group", "first_name", "last_name", "local_time_window_start",
351
+                "local_time_window_end", "local_time_window_start_2", "local_time_window_end_2", "address_email", "address_country_id", "address_custom_data",
352
+                "schedule_blacklist", "service_time", "local_timezone_string", "color", "address_icon", "address_stop_type", "address_cube", "address_pieces",
353
+                "address_reference_no", "address_revenue", "address_weight", "address_priority", "address_customer_po");
354 354
 
355 355
         if (empty($columns)) {
356 356
             array_push($results['fail'], 'Empty CSV table');
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
         $iRow = 1;
361 361
         
362
-        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr)) !== false) {
362
+        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
363 363
             if ($rows[$locationsFieldsMapping['cached_lat']] 
364 364
                   && $rows[$locationsFieldsMapping['cached_lng']] 
365 365
                   && $rows[$locationsFieldsMapping['address_1']] 
@@ -391,10 +391,10 @@  discard block
 block discarded – undo
391 391
                 
392 392
                 if (isset($rows[$locationsFieldsMapping['schedule_every']])) {
393 393
                     if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) {
394
-                        $curSchedule.='"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
395
-                        if ($mode == 'daily') {
396
-                            $curSchedule = trim($curSchedule,',');
397
-                            $curSchedule.='}';
394
+                        $curSchedule .= '"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
395
+                        if ($mode=='daily') {
396
+                            $curSchedule = trim($curSchedule, ',');
397
+                            $curSchedule .= '}';
398 398
                         }
399 399
                     } else {
400 400
                         array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
                                 $curSchedule = "";
433 433
                             }
434 434
                             
435
-                            if ($monthlyMode != "") {
435
+                            if ($monthlyMode!="") {
436 436
                                 switch ($monthlyMode) {
437 437
                                     case 'dates':
438 438
                                         if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
                                             $curSchedule = "";
458 458
                                         }
459 459
                                         
460
-                                        if ($curSchedule != "") {
460
+                                        if ($curSchedule!="") {
461 461
                                             if (isset($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
462 462
                                                 if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_wwhat']])) {
463 463
                                                      $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_wwhat']].'}}';
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
                     }
481 481
                 }
482 482
 
483
-                if (($mode == 'daily' || $mode == 'weekly' || $mode == 'monthy') && $curSchedule == "") {
483
+                if (($mode=='daily' || $mode=='weekly' || $mode=='monthy') && $curSchedule=="") {
484 484
                     $iRow++; 
485 485
                     continue;
486 486
                 }
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                 
490 490
                 $curSchedule = '[{'.$curSchedule.'}]';
491 491
 
492
-                $oSchedule = json_decode($curSchedule,TRUE);
492
+                $oSchedule = json_decode($curSchedule, TRUE);
493 493
                 
494 494
                 $parametersArray = array();
495 495
                 
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -258,14 +258,18 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $weekdays = explode(',', $scheduleWeekDays);
260 260
         
261
-        if (sizeof($weekdays)<1) return FALSE;
261
+        if (sizeof($weekdays)<1) {
262
+        	return FALSE;
263
+        }
262 264
         
263 265
         $isValid = TRUE;
264 266
         
265 267
         for ($i=0; $i<sizeof($weekdays); $i++) { 
266 268
             if (is_numeric($weekdays[$i])) {
267 269
                 $wday = intval($weekdays[$i]);
268
-                if ($wday<1 || $wday>7) $isValid = FALSE;
270
+                if ($wday<1 || $wday>7) {
271
+                	$isValid = FALSE;
272
+                }
269 273
             } else {
270 274
                 $isValid = FALSE;
271 275
             }
@@ -289,14 +293,18 @@  discard block
 block discarded – undo
289 293
     {
290 294
         $monthlyDates = explode(',', $scheduleMonthlyDates);
291 295
         
292
-        if (sizeof($monthlyDates) <1) return FALSE;
296
+        if (sizeof($monthlyDates) <1) {
297
+        	return FALSE;
298
+        }
293 299
         
294 300
         $isValid = TRUE;
295 301
         
296 302
         for ($i=0; $i < sizeof($monthlyDates); $i++) { 
297 303
             if (is_numeric($monthlyDates[$i])) {
298 304
                 $mday = intval($monthlyDates[$i]);
299
-                if ($mday <1 || $mday > 31) $isValid = FALSE;
305
+                if ($mday <1 || $mday > 31) {
306
+                	$isValid = FALSE;
307
+                }
300 308
             } else {
301 309
                 $isValid = FALSE;
302 310
             }
@@ -307,7 +315,9 @@  discard block
 block discarded – undo
307 315
     
308 316
     public static function validateScheduleNthN($scheduleNthN)
309 317
     {
310
-        if (!is_numeric($scheduleNthN)) return FALSE;
318
+        if (!is_numeric($scheduleNthN)) {
319
+        	return FALSE;
320
+        }
311 321
         
312 322
         $schedNthNs = array(1, 2, 3, 4, 5, -1);
313 323
         
@@ -320,7 +330,9 @@  discard block
 block discarded – undo
320 330
     
321 331
     public static function validateScheduleNthWhat($scheduleNthWhat)
322 332
     {
323
-        if (!is_numeric($scheduleNthWhat)) return FALSE;
333
+        if (!is_numeric($scheduleNthWhat)) {
334
+        	return FALSE;
335
+        }
324 336
         
325 337
         $schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
326 338
         
Please login to merge, or discard this patch.