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.
Completed
Push — master ( d70a9b...6b18d7 )
by Oleg
02:56
created
examples/AddressBook/GetAddressBookLocations.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
 // Example refers to getting the address book locations
14 14
 
15 15
 $AddressBookLocationParameters = array(
16
-    "limit"   => 30,
17
-    "offset"  => 0
16
+	"limit"   => 30,
17
+	"offset"  => 0
18 18
 );
19 19
 
20 20
 $abContacts = new AddressBookLocation();
@@ -25,5 +25,5 @@  discard block
 block discarded – undo
25 25
 
26 26
 foreach ($results as $result) {
27 27
 	Route4Me::simplePrint($result);
28
-    echo "<br>";
28
+	echo "<br>";
29 29
 }
Please login to merge, or discard this patch.
examples/AddressBook/UpdateAddressBookLocation.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 Route4Me::setApiKey('11111111111111111111111111111111');
14 14
 
15 15
 $AddressBookLocationParameters = AddressBookLocation::fromArray(array(
16
-    "first_name"  => "Test FirstName ".strval(rand(10000, 99999)),
17
-    "address_1"   => "Test Address1 ".strval(rand(10000, 99999)),
18
-    "cached_lat"  => 38.024654,
19
-    "cached_lng"  => -77.338814
16
+	"first_name"  => "Test FirstName ".strval(rand(10000, 99999)),
17
+	"address_1"   => "Test Address1 ".strval(rand(10000, 99999)),
18
+	"cached_lat"  => 38.024654,
19
+	"cached_lng"  => -77.338814
20 20
 ));
21 21
 
22 22
 $abLocation = new AddressBookLocation();
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 assert(isset($abcResult['address_id']), "Cannot create an address book location. <br><br>");
29 29
 
30 30
 if (isset($abcResult["address_id"])) {
31
-    $address_id = $abcResult["address_id"];
31
+	$address_id = $abcResult["address_id"];
32 32
 }
33 33
 
34 34
 assert($address_id!=-1, "Cannot create an address book location. <br><br>");
Please login to merge, or discard this patch.
src/Route4Me/ActivityParameters.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -6,78 +6,78 @@
 block discarded – undo
6 6
 
7 7
 class ActivityParameters extends Common
8 8
 {
9
-    public $route_id;
10
-    public $device_id;
11
-    public $member_id;
12
-    public $team;
13
-    public $limit;
14
-    public $offset;
15
-    public $start;
16
-    public $end;
17
-    public $activity_type;
18
-    public $activity_message;
9
+	public $route_id;
10
+	public $device_id;
11
+	public $member_id;
12
+	public $team;
13
+	public $limit;
14
+	public $offset;
15
+	public $start;
16
+	public $end;
17
+	public $activity_type;
18
+	public $activity_message;
19 19
     
20
-    public $activity_id;
21
-    public $activity_timestamp;
22
-    public $route_destination_id;
23
-    public $note_id;
24
-    public $member;
25
-    public $note_type;
26
-    public $note_contents;
27
-    public $route_name;
28
-    public $note_file;
29
-    public $destination_name;
30
-    public $destination_alias;
20
+	public $activity_id;
21
+	public $activity_timestamp;
22
+	public $route_destination_id;
23
+	public $note_id;
24
+	public $member;
25
+	public $note_type;
26
+	public $note_contents;
27
+	public $route_name;
28
+	public $note_file;
29
+	public $destination_name;
30
+	public $destination_alias;
31 31
     
32
-    public static function fromArray(array $params) 
33
-    {
34
-        $activityparameters = new ActivityParameters();
32
+	public static function fromArray(array $params) 
33
+	{
34
+		$activityparameters = new ActivityParameters();
35 35
         
36
-        foreach ($params as $key => $value) {
37
-            if (property_exists($activityparameters, $key)) {
38
-                $activityparameters->{$key} = $value;
39
-            }
40
-        }
36
+		foreach ($params as $key => $value) {
37
+			if (property_exists($activityparameters, $key)) {
38
+				$activityparameters->{$key} = $value;
39
+			}
40
+		}
41 41
         
42
-        return $activityparameters;
43
-    }
42
+		return $activityparameters;
43
+	}
44 44
     
45
-    public static function getActivities($params)
46
-    {
47
-        $allQueryFields = array('route_id', 'team', 'limit', 'offset', 'start');
45
+	public static function getActivities($params)
46
+	{
47
+		$allQueryFields = array('route_id', 'team', 'limit', 'offset', 'start');
48 48
         
49
-        $activity = Route4Me::makeRequst(array(
50
-            'url'    => Endpoint::GET_ACTIVITIES,
51
-            'method' => 'GET',
52
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
53
-        ));
49
+		$activity = Route4Me::makeRequst(array(
50
+			'url'    => Endpoint::GET_ACTIVITIES,
51
+			'method' => 'GET',
52
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
53
+		));
54 54
 
55
-        return $activity;
56
-    }
55
+		return $activity;
56
+	}
57 57
 
58
-    public static function searchActivities($params)
59
-    {
60
-        $allQueryFields = array('route_id', 'limit', 'offset', 'activity_type');
58
+	public static function searchActivities($params)
59
+	{
60
+		$allQueryFields = array('route_id', 'limit', 'offset', 'activity_type');
61 61
         
62
-        $activity = Route4Me::makeRequst(array(
63
-            'url'    => Endpoint::GET_ACTIVITIES,
64
-            'method' => 'GET',
65
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
66
-        ));
62
+		$activity = Route4Me::makeRequst(array(
63
+			'url'    => Endpoint::GET_ACTIVITIES,
64
+			'method' => 'GET',
65
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
66
+		));
67 67
 
68
-        return $activity;
69
-    }
68
+		return $activity;
69
+	}
70 70
     
71
-    public static function sendUserMessage($params)
72
-    {
73
-        $allBodyFields = array('activity_type', 'activity_message', 'route_id');
71
+	public static function sendUserMessage($params)
72
+	{
73
+		$allBodyFields = array('activity_type', 'activity_message', 'route_id');
74 74
         
75
-        $result = Route4Me::makeRequst(array(
76
-            'url'    => Endpoint::ACTIVITY_FEED,
77
-            'method' => 'POST',
78
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
79
-        ));
75
+		$result = Route4Me::makeRequst(array(
76
+			'url'    => Endpoint::ACTIVITY_FEED,
77
+			'method' => 'POST',
78
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
79
+		));
80 80
         
81
-        return $result;
82
-    }
81
+		return $result;
82
+	}
83 83
 }
Please login to merge, or discard this patch.
examples/Optimizations/hybridOptimization.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -44,21 +44,21 @@  discard block
 block discarded – undo
44 44
 $locationsFieldsMapping['monthly_nth_what'] = 17;
45 45
 
46 46
 if (($handle = fopen("$source_file", "r"))!==FALSE) {
47
-    $oAbook = new AddressBookLocation();
47
+	$oAbook = new AddressBookLocation();
48 48
 
49
-    $results = $oAbook->addLocationsFromCsvFile($handle, $locationsFieldsMapping);
49
+	$results = $oAbook->addLocationsFromCsvFile($handle, $locationsFieldsMapping);
50 50
     
51
-    echo "Errors: <br><br>";
51
+	echo "Errors: <br><br>";
52 52
     
53
-    foreach ($results['fail'] as $evalue) {
54
-        echo $evalue."<br>";
55
-    }
53
+	foreach ($results['fail'] as $evalue) {
54
+		echo $evalue."<br>";
55
+	}
56 56
     
57
-    echo "Successes: <br><br>";
57
+	echo "Successes: <br><br>";
58 58
     
59
-    foreach ($results['success'] as $svalue) {
60
-        echo $svalue."<br>";
61
-    }
59
+	foreach ($results['success'] as $svalue) {
60
+		echo $svalue."<br>";
61
+	}
62 62
 }
63 63
 
64 64
 /* Add orders with schedules from a CSV file  */
@@ -78,20 +78,20 @@  discard block
 block discarded – undo
78 78
 $ordersFieldsMapping['day_scheduled_for_YYMMDD'] = 8;
79 79
 
80 80
 if (($handle = fopen("$orders_file", "r"))!==FALSE) {
81
-    $order = new Order();
82
-    $results = $order->addOrdersFromCsvFile($handle, $ordersFieldsMapping);
81
+	$order = new Order();
82
+	$results = $order->addOrdersFromCsvFile($handle, $ordersFieldsMapping);
83 83
     
84
-    echo "Errors: <br><br>";
84
+	echo "Errors: <br><br>";
85 85
     
86
-    foreach ($results['fail'] as $evalue) {
87
-        echo $evalue."<br>";
88
-    }
86
+	foreach ($results['fail'] as $evalue) {
87
+		echo $evalue."<br>";
88
+	}
89 89
     
90
-    echo "Successes: <br><br>";
90
+	echo "Successes: <br><br>";
91 91
     
92
-    foreach ($results['success'] as $svalue) {
93
-        echo $svalue."<br>";
94
-    }
92
+	foreach ($results['success'] as $svalue) {
93
+		echo $svalue."<br>";
94
+	}
95 95
 }
96 96
 
97 97
 /* Get Hybrid Optimization */
@@ -100,63 +100,63 @@  discard block
 block discarded – undo
100 100
 $sched_date = date("Y-m-d", $ep);
101 101
 
102 102
 $hybridParams = array(
103
-    "target_date_string" => $sched_date,
104
-    "timezone_offset_minutes" => 480
103
+	"target_date_string" => $sched_date,
104
+	"timezone_offset_minutes" => 480
105 105
 );
106 106
 
107 107
 $optimization = new OptimizationProblem(); 
108 108
 $hybridOptimization = $optimization->getHybridOptimization($hybridParams);
109 109
 
110 110
 if ($hybridOptimization!=null) {
111
-    if (isset($hybridOptimization['optimization_problem_id'])) {
112
-        $optid = $hybridOptimization['optimization_problem_id'];
111
+	if (isset($hybridOptimization['optimization_problem_id'])) {
112
+		$optid = $hybridOptimization['optimization_problem_id'];
113 113
         
114
-        echo "Hibrid optimization with optimization_problem_id = $optid <br><br>";
114
+		echo "Hibrid optimization with optimization_problem_id = $optid <br><br>";
115 115
         
116
-        /* Add depots to the Hybrid Optimization */
117
-        $depotfile = "depots.csv";
116
+		/* Add depots to the Hybrid Optimization */
117
+		$depotfile = "depots.csv";
118 118
         
119
-        if (($handle = fopen("$depotfile", "r"))!==FALSE) {
120
-            $columns = fgetcsv($handle, $max_line_length, $delimiter);
119
+		if (($handle = fopen("$depotfile", "r"))!==FALSE) {
120
+			$columns = fgetcsv($handle, $max_line_length, $delimiter);
121 121
             
122
-            if (empty($columns)) {
123
-                $error['message'] = 'Empty';
124
-                return ($error);
125
-            }
122
+			if (empty($columns)) {
123
+				$error['message'] = 'Empty';
124
+				return ($error);
125
+			}
126 126
             
127
-            $depotsParams = array(
128
-                'optimization_problem_id' => $optid,
129
-                'delete_old_depots'       => true,
130
-            );
127
+			$depotsParams = array(
128
+				'optimization_problem_id' => $optid,
129
+				'delete_old_depots'       => true,
130
+			);
131 131
             
132
-            $iRow = 1;
133
-            $depotAddresses = array();
132
+			$iRow = 1;
133
+			$depotAddresses = array();
134 134
             
135
-            while (($rows = fgetcsv($handle, $max_line_length, $delimiter))!==false) {
136
-                if ($rows[0] && $rows[1] && $rows[3] && array(null)!==$rows) {
137
-                    $depotAddress['lat'] = $rows[0];
138
-                    $depotAddress['lng'] = $rows[1];
139
-                    $depotAddress['address'] = $rows[3];   
140
-                    array_push($depotAddresses, $depotAddress);
141
-                }
142
-            }
135
+			while (($rows = fgetcsv($handle, $max_line_length, $delimiter))!==false) {
136
+				if ($rows[0] && $rows[1] && $rows[3] && array(null)!==$rows) {
137
+					$depotAddress['lat'] = $rows[0];
138
+					$depotAddress['lng'] = $rows[1];
139
+					$depotAddress['address'] = $rows[3];   
140
+					array_push($depotAddresses, $depotAddress);
141
+				}
142
+			}
143 143
             
144
-            $depotsParams['new_depots'] = $depotAddresses;
144
+			$depotsParams['new_depots'] = $depotAddresses;
145 145
             
146
-            $optProblem = new OptimizationProblem();
146
+			$optProblem = new OptimizationProblem();
147 147
             
148
-            $resultDepots = $optProblem->addDepotsToHybrid($depotsParams);
148
+			$resultDepots = $optProblem->addDepotsToHybrid($depotsParams);
149 149
             
150
-            /* Reoptimize hybrid optimization */
150
+			/* Reoptimize hybrid optimization */
151 151
             
152
-            if ($resultDepots!=null) {
153
-                $problemParams = array(
154
-                    'optimization_problem_id'  =>  $optid
155
-                );
156
-                $problem = OptimizationProblem::reoptimize($problemParams);
152
+			if ($resultDepots!=null) {
153
+				$problemParams = array(
154
+					'optimization_problem_id'  =>  $optid
155
+				);
156
+				$problem = OptimizationProblem::reoptimize($problemParams);
157 157
                 
158
-                Route4Me::simplePrint($problem);
159
-            }
160
-        }
161
-    }
158
+				Route4Me::simplePrint($problem);
159
+			}
160
+		}
161
+	}
162 162
 }
Please login to merge, or discard this patch.
src/Route4Me/AddressBookLocation.php 2 patches
Indentation   +370 added lines, -370 removed lines patch added patch discarded remove patch
@@ -6,449 +6,449 @@
 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 65
     
66
-    public static function getAddressBookLocation($addressId)
67
-    {
68
-        $ablocations = Route4Me::makeRequst(array(
69
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
70
-            'method' => 'GET',
71
-            'query'  => array(
72
-                'query' => $addressId,
73
-                'limit' => 30
74
-            )
75
-        ));
66
+	public static function getAddressBookLocation($addressId)
67
+	{
68
+		$ablocations = Route4Me::makeRequst(array(
69
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
70
+			'method' => 'GET',
71
+			'query'  => array(
72
+				'query' => $addressId,
73
+				'limit' => 30
74
+			)
75
+		));
76 76
 
77
-        return $ablocations;
78
-    }
77
+		return $ablocations;
78
+	}
79 79
     
80
-    public static function searchAddressBookLocations($params)
81
-    {
82
-        $allQueryFields = array('display', 'query', 'fields', 'limit', 'offset');
80
+	public static function searchAddressBookLocations($params)
81
+	{
82
+		$allQueryFields = array('display', 'query', 'fields', 'limit', 'offset');
83 83
         
84
-        $result = Route4Me::makeRequst(array(
85
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
86
-            'method' => 'GET',
87
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
88
-        ));
84
+		$result = Route4Me::makeRequst(array(
85
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
86
+			'method' => 'GET',
87
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
88
+		));
89 89
 
90
-        return $result;
91
-    }
90
+		return $result;
91
+	}
92 92
     
93
-    public static function getAddressBookLocations($params)
94
-    {
95
-        $allQueryFields = array('limit', 'offset', 'address_id');
93
+	public static function getAddressBookLocations($params)
94
+	{
95
+		$allQueryFields = array('limit', 'offset', 'address_id');
96 96
         
97
-        $ablocations = Route4Me::makeRequst(array(
98
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
99
-            'method' => 'GET',
100
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
101
-        ));
97
+		$ablocations = Route4Me::makeRequst(array(
98
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
99
+			'method' => 'GET',
100
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
101
+		));
102 102
 
103
-        return $ablocations;
104
-    }
103
+		return $ablocations;
104
+	}
105 105
     
106
-    public static function getRandomAddressBookLocation($params)
107
-    {
108
-        $ablocations = self::getAddressBookLocations($params);
106
+	public static function getRandomAddressBookLocation($params)
107
+	{
108
+		$ablocations = self::getAddressBookLocations($params);
109 109
         
110
-        if (isset($ablocations["results"])) {
111
-            $locationsSize = sizeof($ablocations["results"]);
110
+		if (isset($ablocations["results"])) {
111
+			$locationsSize = sizeof($ablocations["results"]);
112 112
             
113
-            if ($locationsSize>0) {
114
-                $randomLocationIndex = rand(0, $locationsSize - 1);
115
-                return $ablocations["results"][$randomLocationIndex];
116
-            } 
117
-        } 
113
+			if ($locationsSize>0) {
114
+				$randomLocationIndex = rand(0, $locationsSize - 1);
115
+				return $ablocations["results"][$randomLocationIndex];
116
+			} 
117
+		} 
118 118
 
119
-        return null;
120
-    }
119
+		return null;
120
+	}
121 121
     
122
-    /**
123
-     * @param AddressBookLocation $params
124
-    */
125
-    public static function addAdressBookLocation($params)
126
-    {
127
-        $allBodyFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('address_id', 'in_route_count'));
122
+	/**
123
+	 * @param AddressBookLocation $params
124
+	 */
125
+	public static function addAdressBookLocation($params)
126
+	{
127
+		$allBodyFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('address_id', 'in_route_count'));
128 128
         
129
-        $response = Route4Me::makeRequst(array(
130
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
131
-            'method' => 'POST',
132
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
133
-        ));
129
+		$response = Route4Me::makeRequst(array(
130
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
131
+			'method' => 'POST',
132
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
133
+		));
134 134
 
135
-        return $response;
136
-    }
135
+		return $response;
136
+	}
137 137
     
138
-    public function deleteAdressBookLocation($address_ids)
139
-    {
140
-        $result = Route4Me::makeRequst(array(
141
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
142
-            'method' => 'DELETEARRAY',
143
-            'query'  => array(
144
-                'address_ids' => $address_ids
145
-            )
146
-        ));
138
+	public function deleteAdressBookLocation($address_ids)
139
+	{
140
+		$result = Route4Me::makeRequst(array(
141
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
142
+			'method' => 'DELETEARRAY',
143
+			'query'  => array(
144
+				'address_ids' => $address_ids
145
+			)
146
+		));
147 147
 
148
-        return $result;
149
-    }
148
+		return $result;
149
+	}
150 150
     
151
-    public function updateAddressBookLocation($params)
152
-    {
153
-        $allBodyFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('in_route_count'));
151
+	public function updateAddressBookLocation($params)
152
+	{
153
+		$allBodyFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('in_route_count'));
154 154
 
155
-        $response = Route4Me::makeRequst(array(
156
-            'url'    => Endpoint::ADDRESS_BOOK_V4,
157
-            'method' => 'PUT',
158
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
159
-        ));
155
+		$response = Route4Me::makeRequst(array(
156
+			'url'    => Endpoint::ADDRESS_BOOK_V4,
157
+			'method' => 'PUT',
158
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
159
+		));
160 160
 
161
-        return $response;
162
-    }
161
+		return $response;
162
+	}
163 163
         
164
-    public static function validateScheduleMode($scheduleMode)
165
-    {
166
-        $schedMmodes = array("daily", "weekly", "monthly", "annually");
164
+	public static function validateScheduleMode($scheduleMode)
165
+	{
166
+		$schedMmodes = array("daily", "weekly", "monthly", "annually");
167 167
         
168
-        if (in_array($scheduleMode, $schedMmodes)) {
169
-            return TRUE; 
170
-        } else {
171
-            return FALSE;
172
-        }
173
-    }
168
+		if (in_array($scheduleMode, $schedMmodes)) {
169
+			return TRUE; 
170
+		} else {
171
+			return FALSE;
172
+		}
173
+	}
174 174
     
175
-    public static function validateScheduleEnable($scheduleEnabled)
176
-    {
177
-        $schedEnables = array(TRUE, FALSE);
175
+	public static function validateScheduleEnable($scheduleEnabled)
176
+	{
177
+		$schedEnables = array(TRUE, FALSE);
178 178
         
179
-        if (in_array($scheduleEnabled, $schedEnables)) {
180
-            return TRUE;
181
-        } else {
182
-            return FALSE;
183
-        }
184
-    }
179
+		if (in_array($scheduleEnabled, $schedEnables)) {
180
+			return TRUE;
181
+		} else {
182
+			return FALSE;
183
+		}
184
+	}
185 185
     
186
-    public static function validateScheduleEvery($scheduleEvery)
187
-    {
188
-        if (is_numeric($scheduleEvery)) {
189
-            return TRUE;
190
-        } else {
191
-            return FALSE;
192
-        }
193
-    }
186
+	public static function validateScheduleEvery($scheduleEvery)
187
+	{
188
+		if (is_numeric($scheduleEvery)) {
189
+			return TRUE;
190
+		} else {
191
+			return FALSE;
192
+		}
193
+	}
194 194
     
195
-    public static function validateScheduleWeekDays($scheduleWeekDays)
196
-    {
197
-        $weekdays = explode(',', $scheduleWeekDays);
198
-        $weekdaysSize = sizeof($weekdays);
195
+	public static function validateScheduleWeekDays($scheduleWeekDays)
196
+	{
197
+		$weekdays = explode(',', $scheduleWeekDays);
198
+		$weekdaysSize = sizeof($weekdays);
199 199
         
200
-        if ($weekdaysSize<1) {
201
-            return FALSE;
202
-        }
200
+		if ($weekdaysSize<1) {
201
+			return FALSE;
202
+		}
203 203
         
204
-        $isValid = TRUE;
204
+		$isValid = TRUE;
205 205
         
206
-        for ($i = 0; $i<$weekdaysSize; $i++) { 
207
-            if (is_numeric($weekdays[$i])) {
208
-                $wday = intval($weekdays[$i]);
209
-                if ($wday<1 || $wday>7) {
210
-                    $isValid = FALSE;
211
-                }
212
-            } else {
213
-                $isValid = FALSE;
214
-            }
215
-        }
206
+		for ($i = 0; $i<$weekdaysSize; $i++) { 
207
+			if (is_numeric($weekdays[$i])) {
208
+				$wday = intval($weekdays[$i]);
209
+				if ($wday<1 || $wday>7) {
210
+					$isValid = FALSE;
211
+				}
212
+			} else {
213
+				$isValid = FALSE;
214
+			}
215
+		}
216 216
         
217
-        return $isValid;
218
-    }
217
+		return $isValid;
218
+	}
219 219
     
220
-    public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
221
-    {
222
-        $schedMonthlyMmodes = array("dates", "nth");
220
+	public static function validateScheduleMonthlyMode($scheduleMonthlyMode)
221
+	{
222
+		$schedMonthlyMmodes = array("dates", "nth");
223 223
         
224
-        if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) {
225
-            return TRUE;
226
-        } else {
227
-            return FALSE;
228
-        }
229
-    }
224
+		if (in_array($scheduleMonthlyMode, $schedMonthlyMmodes)) {
225
+			return TRUE;
226
+		} else {
227
+			return FALSE;
228
+		}
229
+	}
230 230
     
231
-    public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
232
-    {
233
-        $monthlyDates = explode(',', $scheduleMonthlyDates);
234
-        $monthlyDatesSize = sizeof($monthlyDates);
231
+	public static function validateScheduleMonthlyDates($scheduleMonthlyDates)
232
+	{
233
+		$monthlyDates = explode(',', $scheduleMonthlyDates);
234
+		$monthlyDatesSize = sizeof($monthlyDates);
235 235
         
236
-        if ($monthlyDatesSize<1) {
237
-            return FALSE;
238
-        }
236
+		if ($monthlyDatesSize<1) {
237
+			return FALSE;
238
+		}
239 239
         
240
-        $isValid = TRUE;
240
+		$isValid = TRUE;
241 241
         
242
-        for ($i = 0; $i<$monthlyDatesSize; $i++) { 
243
-            if (is_numeric($monthlyDates[$i])) {
244
-                $mday = intval($monthlyDates[$i]);
245
-                if ($mday<1 || $mday>31) {
246
-                    $isValid = FALSE;
247
-                }
248
-            } else {
249
-                $isValid = FALSE;
250
-            }
251
-        }
242
+		for ($i = 0; $i<$monthlyDatesSize; $i++) { 
243
+			if (is_numeric($monthlyDates[$i])) {
244
+				$mday = intval($monthlyDates[$i]);
245
+				if ($mday<1 || $mday>31) {
246
+					$isValid = FALSE;
247
+				}
248
+			} else {
249
+				$isValid = FALSE;
250
+			}
251
+		}
252 252
 
253
-        return $isValid;
254
-    }
253
+		return $isValid;
254
+	}
255 255
     
256
-    public static function validateScheduleNthN($scheduleNthN)
257
-    {
258
-        if (!is_numeric($scheduleNthN)) {
259
-            return FALSE;
260
-        }
256
+	public static function validateScheduleNthN($scheduleNthN)
257
+	{
258
+		if (!is_numeric($scheduleNthN)) {
259
+			return FALSE;
260
+		}
261 261
         
262
-        $schedNthNs = array(1, 2, 3, 4, 5, -1);
262
+		$schedNthNs = array(1, 2, 3, 4, 5, -1);
263 263
         
264
-        if (in_array($scheduleNthN, $schedNthNs)) {
265
-            return TRUE;
266
-        } else {
267
-            return FALSE;
268
-        }
269
-    }
264
+		if (in_array($scheduleNthN, $schedNthNs)) {
265
+			return TRUE;
266
+		} else {
267
+			return FALSE;
268
+		}
269
+	}
270 270
     
271
-    public static function validateScheduleNthWhat($scheduleNthWhat)
272
-    {
273
-        if (!is_numeric($scheduleNthWhat)) {
274
-            return FALSE;
275
-        }
271
+	public static function validateScheduleNthWhat($scheduleNthWhat)
272
+	{
273
+		if (!is_numeric($scheduleNthWhat)) {
274
+			return FALSE;
275
+		}
276 276
         
277
-        $schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
277
+		$schedNthWhats = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
278 278
         
279
-        if (in_array($scheduleNthWhat, $schedNthWhats)) {
280
-            return TRUE;
281
-        } else {
282
-            return FALSE;
283
-        }
284
-    }
279
+		if (in_array($scheduleNthWhat, $schedNthWhats)) {
280
+			return TRUE;
281
+		} else {
282
+			return FALSE;
283
+		}
284
+	}
285 285
     
286
-    /** Function adds the locations (with/without schedule) from the CSV file. 
287
-     * $csvFileHandle - a file handler.
288
-     * Returns array $results which contains two arrays: fail and succes.
289
-     */
290
-    public function addLocationsFromCsvFile($csvFileHandle, $locationsFieldsMapping)
291
-    {
292
-        $max_line_length = 512;
293
-        $delemietr = ',';
286
+	/** Function adds the locations (with/without schedule) from the CSV file. 
287
+	 * $csvFileHandle - a file handler.
288
+	 * Returns array $results which contains two arrays: fail and succes.
289
+	 */
290
+	public function addLocationsFromCsvFile($csvFileHandle, $locationsFieldsMapping)
291
+	{
292
+		$max_line_length = 512;
293
+		$delemietr = ',';
294 294
         
295
-        $results = array();
296
-        $results['fail'] = array();
297
-        $results['success'] = array();
295
+		$results = array();
296
+		$results['fail'] = array();
297
+		$results['success'] = array();
298 298
         
299
-        $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
299
+		$columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
300 300
         
301
-        $addressBookFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('address_id', 'in_route_count'));
301
+		$addressBookFields = Route4Me::getObjectProperties(new AddressBookLocation(), array('address_id', 'in_route_count'));
302 302
 
303
-        if (empty($columns)) {
304
-            array_push($results['fail'], 'Empty CSV table');
305
-            return ($results);
306
-        }
303
+		if (empty($columns)) {
304
+			array_push($results['fail'], 'Empty CSV table');
305
+			return ($results);
306
+		}
307 307
 
308
-        $iRow = 1;
308
+		$iRow = 1;
309 309
         
310
-        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
311
-            if (!isset($rows[$locationsFieldsMapping['cached_lat']]) || !isset($rows[$locationsFieldsMapping['cached_lng']]) 
312
-                  || !isset($rows[$locationsFieldsMapping['address_1']]) || array(null)==$rows) {
313
-                continue;
314
-            }
310
+		while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
311
+			if (!isset($rows[$locationsFieldsMapping['cached_lat']]) || !isset($rows[$locationsFieldsMapping['cached_lng']]) 
312
+				  || !isset($rows[$locationsFieldsMapping['address_1']]) || array(null)==$rows) {
313
+				continue;
314
+			}
315 315
                       
316
-            $curSchedule = "";
317
-            $mode = "";
316
+			$curSchedule = "";
317
+			$mode = "";
318 318
             
319
-            $failCount = sizeof($results['fail']); 
319
+			$failCount = sizeof($results['fail']); 
320 320
             
321
-            if (isset($rows[$locationsFieldsMapping['schedule_mode']])) {
322
-                if ($this->validateScheduleMode($rows[$locationsFieldsMapping['schedule_mode']])) {
323
-                    $curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; 
324
-                    $mode = $rows[$locationsFieldsMapping['schedule_mode']];
325
-                } else {
326
-                    array_push($results['fail'], "$iRow --> Wrong schedule mode parameter"); 
327
-                }
328
-            } else {
329
-                array_push($results['fail'], "$iRow --> The schedule mode parameter is not set"); 
330
-            }
321
+			if (isset($rows[$locationsFieldsMapping['schedule_mode']])) {
322
+				if ($this->validateScheduleMode($rows[$locationsFieldsMapping['schedule_mode']])) {
323
+					$curSchedule = '"mode":"'.$rows[$locationsFieldsMapping['schedule_mode']].'",'; 
324
+					$mode = $rows[$locationsFieldsMapping['schedule_mode']];
325
+				} else {
326
+					array_push($results['fail'], "$iRow --> Wrong schedule mode parameter"); 
327
+				}
328
+			} else {
329
+				array_push($results['fail'], "$iRow --> The schedule mode parameter is not set"); 
330
+			}
331 331
             
332
-            if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) {
333
-                if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { 
334
-                    $curSchedule .= '"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].',';
335
-                } else {
336
-                    array_push($results['fail'], "$iRow --> The schedule enabled parameter is not set ");  
337
-                }
338
-            }
332
+			if (isset($rows[$locationsFieldsMapping['schedule_enabled']])) {
333
+				if ($this->validateScheduleEnable($rows[$locationsFieldsMapping['schedule_enabled']])) { 
334
+					$curSchedule .= '"enabled":'.$rows[$locationsFieldsMapping['schedule_enabled']].',';
335
+				} else {
336
+					array_push($results['fail'], "$iRow --> The schedule enabled parameter is not set ");  
337
+				}
338
+			}
339 339
             
340
-            if (isset($rows[$locationsFieldsMapping['schedule_every']])) {
341
-                if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) {
342
-                    $curSchedule .= '"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
343
-                    if ($mode=='daily') {
344
-                        $curSchedule = trim($curSchedule, ',');
345
-                        $curSchedule .= '}';
346
-                    }
347
-                } else {
348
-                    array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); 
349
-                }
350
-            }
340
+			if (isset($rows[$locationsFieldsMapping['schedule_every']])) {
341
+				if ($this->validateScheduleEvery($rows[$locationsFieldsMapping['schedule_every']])) {
342
+					$curSchedule .= '"'.$mode.'":{'.'"every":'.$rows[$locationsFieldsMapping['schedule_every']].','; 
343
+					if ($mode=='daily') {
344
+						$curSchedule = trim($curSchedule, ',');
345
+						$curSchedule .= '}';
346
+					}
347
+				} else {
348
+					array_push($results['fail'], "$iRow --> The parameter sched_every is not set"); 
349
+				}
350
+			}
351 351
             
352
-            if ($mode!='daily') {
353
-                switch ($mode) {
354
-                    case 'weekly':
355
-                        if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
356
-                            if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
357
-                                 $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
358
-                            } else {
359
-                                array_push($results['fail'], "$iRow --> Wrong weekdays"); 
360
-                            }
361
-                        } else {
362
-                            array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
363
-                        }
364
-                        break;
365
-                    case 'monthly':
366
-                        $monthlyMode = "";
367
-                        if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
368
-                            if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
369
-                                 $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
370
-                                 $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
371
-                            } else {
372
-                                array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
373
-                            }
374
-                        } else {
375
-                            array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
376
-                        }
352
+			if ($mode!='daily') {
353
+				switch ($mode) {
354
+					case 'weekly':
355
+						if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
356
+							if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
357
+								 $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
358
+							} else {
359
+								array_push($results['fail'], "$iRow --> Wrong weekdays"); 
360
+							}
361
+						} else {
362
+							array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
363
+						}
364
+						break;
365
+					case 'monthly':
366
+						$monthlyMode = "";
367
+						if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
368
+							if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
369
+								 $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
370
+								 $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
371
+							} else {
372
+								array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
373
+							}
374
+						} else {
375
+							array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
376
+						}
377 377
                         
378
-                        if ($monthlyMode!="") {
379
-                            switch ($monthlyMode) {
380
-                                case 'dates':
381
-                                    if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
382
-                                        if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
383
-                                             $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
384
-                                        } else {
385
-                                            array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
386
-                                        }
387
-                                    }
388
-                                    break;
389
-                                case 'nth':
390
-                                    if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
391
-                                        if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
392
-                                             $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
393
-                                        } else {
394
-                                            array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
395
-                                        }
396
-                                    } else {
397
-                                        array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
398
-                                    }
378
+						if ($monthlyMode!="") {
379
+							switch ($monthlyMode) {
380
+								case 'dates':
381
+									if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
382
+										if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
383
+											 $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
384
+										} else {
385
+											array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
386
+										}
387
+									}
388
+									break;
389
+								case 'nth':
390
+									if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
391
+										if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
392
+											 $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
393
+										} else {
394
+											array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
395
+										}
396
+									} else {
397
+										array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
398
+									}
399 399
                                     
400
-                                    if ($curSchedule!="") {
401
-                                        if (isset($rows[$locationsFieldsMapping['monthly_nth_what']])) {
402
-                                            if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_what']])) {
403
-                                                 $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_what']].'}}';
404
-                                            } else {
405
-                                                array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
406
-                                            }
407
-                                        } else {
408
-                                            array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
409
-                                        }
410
-                                    }
411
-                                    break;
412
-                            }
413
-                        }
414
-                        break;
415
-                    default:
416
-                        $curSchedule = "";
417
-                        break;
418
-                }
419
-            }
400
+									if ($curSchedule!="") {
401
+										if (isset($rows[$locationsFieldsMapping['monthly_nth_what']])) {
402
+											if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_what']])) {
403
+												 $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_what']].'}}';
404
+											} else {
405
+												array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
406
+											}
407
+										} else {
408
+											array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
409
+										}
410
+									}
411
+									break;
412
+							}
413
+						}
414
+						break;
415
+					default:
416
+						$curSchedule = "";
417
+						break;
418
+				}
419
+			}
420 420
 
421
-            if (sizeof($results['fail'])>$failCount) {
422
-                $curSchedule = "";
423
-            }
421
+			if (sizeof($results['fail'])>$failCount) {
422
+				$curSchedule = "";
423
+			}
424 424
 
425
-            if (($mode=='daily' || $mode=='weekly' || $mode=='monthy') && $curSchedule=="") {
426
-                $iRow++; 
427
-                continue;
428
-            }
425
+			if (($mode=='daily' || $mode=='weekly' || $mode=='monthy') && $curSchedule=="") {
426
+				$iRow++; 
427
+				continue;
428
+			}
429 429
             
430
-            $curSchedule = strtolower($curSchedule);
430
+			$curSchedule = strtolower($curSchedule);
431 431
             
432
-            $curSchedule = '[{'.$curSchedule.'}]';
432
+			$curSchedule = '[{'.$curSchedule.'}]';
433 433
 
434
-            $parametersArray = array();
434
+			$parametersArray = array();
435 435
             
436
-            foreach ($addressBookFields as $addressBookField) {
437
-                if (isset($locationsFieldsMapping[$addressBookField])) {
438
-                    $parametersArray[$addressBookField] = $rows[$locationsFieldsMapping[$addressBookField]];
439
-                }
440
-            }
436
+			foreach ($addressBookFields as $addressBookField) {
437
+				if (isset($locationsFieldsMapping[$addressBookField])) {
438
+					$parametersArray[$addressBookField] = $rows[$locationsFieldsMapping[$addressBookField]];
439
+				}
440
+			}
441 441
             
442
-            $AdressBookLocationParameters = AddressBookLocation::fromArray($parametersArray);
442
+			$AdressBookLocationParameters = AddressBookLocation::fromArray($parametersArray);
443 443
             
444
-            $abContacts = new AddressBookLocation();
444
+			$abContacts = new AddressBookLocation();
445 445
 
446
-            $abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
446
+			$abcResults = $abContacts->addAdressBookLocation($AdressBookLocationParameters); //temporarry
447 447
             
448
-            array_push($results['success'], "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly.");
449
-        }
448
+			array_push($results['success'], "The schedule location with address_id = ".strval($abcResults["address_id"])." added successfuly.");
449
+		}
450 450
 
451
-        return $results;
452
-    }
451
+		return $results;
452
+	}
453 453
  }
454 454
  
455 455
\ No newline at end of file
Please login to merge, or discard this patch.
Switch Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -351,70 +351,70 @@
 block discarded – undo
351 351
             
352 352
             if ($mode!='daily') {
353 353
                 switch ($mode) {
354
-                    case 'weekly':
355
-                        if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
356
-                            if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
357
-                                 $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
358
-                            } else {
359
-                                array_push($results['fail'], "$iRow --> Wrong weekdays"); 
360
-                            }
354
+                case 'weekly':
355
+                    if (isset($rows[$locationsFieldsMapping['schedule_weekdays']])) {
356
+                        if ($this->validateScheduleWeekDays($rows[$locationsFieldsMapping['schedule_weekdays']])) {
357
+                             $curSchedule .= '"weekdays":['.$rows[$locationsFieldsMapping['schedule_weekdays']].']}';
361 358
                         } else {
362
-                            array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
359
+                            array_push($results['fail'], "$iRow --> Wrong weekdays"); 
363 360
                         }
364
-                        break;
365
-                    case 'monthly':
366
-                        $monthlyMode = "";
367
-                        if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
368
-                            if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
369
-                                 $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
370
-                                 $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
371
-                            } else {
372
-                                array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
373
-                            }
361
+                    } else {
362
+                        array_push($results['fail'], "$iRow --> The parameters sched_weekdays is not set"); 
363
+                    }
364
+                    break;
365
+                case 'monthly':
366
+                    $monthlyMode = "";
367
+                    if (isset($rows[$locationsFieldsMapping['monthly_mode']])) {
368
+                        if ($this->validateScheduleMonthlyMode($rows[$locationsFieldsMapping['monthly_mode']])) {
369
+                             $monthlyMode = $rows[$locationsFieldsMapping['monthly_mode']];
370
+                             $curSchedule .= '"mode": "'.$rows[$locationsFieldsMapping['monthly_mode']].'",';
374 371
                         } else {
375
-                            array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
372
+                            array_push($results['fail'], "$iRow --> Wrong monthly mode"); 
376 373
                         }
374
+                    } else {
375
+                        array_push($results['fail'], "$iRow --> The parameter sched_monthly_mode is not set"); 
376
+                    }
377 377
                         
378
-                        if ($monthlyMode!="") {
379
-                            switch ($monthlyMode) {
380
-                                case 'dates':
381
-                                    if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
382
-                                        if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
383
-                                             $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
384
-                                        } else {
385
-                                            array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
386
-                                        }
387
-                                    }
388
-                                    break;
389
-                                case 'nth':
390
-                                    if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
391
-                                        if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
392
-                                             $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
393
-                                        } else {
394
-                                            array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
395
-                                        }
396
-                                    } else {
397
-                                        array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
398
-                                    }
378
+                    if ($monthlyMode!="") {
379
+                        switch ($monthlyMode) {
380
+                        case 'dates':
381
+                        if (isset($rows[$locationsFieldsMapping['monthly_dates']])) {
382
+                        if ($this->validateScheduleMonthlyDates($rows[$locationsFieldsMapping['monthly_dates']])) {
383
+                             $curSchedule .= '"dates":['.$rows[$locationsFieldsMapping['monthly_dates']].']}';
384
+                        } else {
385
+                            array_push($results['fail'], "$iRow --> Wrong monthly dates"); 
386
+                        }
387
+                        }
388
+                        break;
389
+                        case 'nth':
390
+                        if (isset($rows[$locationsFieldsMapping['monthly_nth_n']])) {
391
+                        if ($this->validateScheduleNthN($rows[$locationsFieldsMapping['monthly_nth_n']])) {
392
+                             $curSchedule .= '"nth":{"n":'.$rows[$locationsFieldsMapping['monthly_nth_n']].',';
393
+                        } else {
394
+                            array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_n"); 
395
+                        }
396
+                        } else {
397
+                        array_push($results['fail'], "$iRow --> The parameter sched_nth_n is not set"); 
398
+                        }
399 399
                                     
400
-                                    if ($curSchedule!="") {
401
-                                        if (isset($rows[$locationsFieldsMapping['monthly_nth_what']])) {
402
-                                            if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_what']])) {
403
-                                                 $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_what']].'}}';
404
-                                            } else {
405
-                                                array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
406
-                                            }
407
-                                        } else {
408
-                                            array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
409
-                                        }
410
-                                    }
411
-                                    break;
400
+                        if ($curSchedule!="") {
401
+                        if (isset($rows[$locationsFieldsMapping['monthly_nth_what']])) {
402
+                            if ($this->validateScheduleNthWhat($rows[$locationsFieldsMapping['monthly_nth_what']])) {
403
+                                 $curSchedule .= '"what":'.$rows[$locationsFieldsMapping['monthly_nth_what']].'}}';
404
+                            } else {
405
+                                array_push($results['fail'], "$iRow --> Wrong parameter sched_nth_what"); 
412 406
                             }
407
+                        } else {
408
+                            array_push($results['fail'], "$iRow --> The parameter sched_nth_what is not set"); 
409
+                        }
413 410
                         }
414 411
                         break;
415
-                    default:
416
-                        $curSchedule = "";
412
+                        }
413
+                        }
417 414
                         break;
415
+                default:
416
+                    $curSchedule = "";
417
+                    break;
418 418
                 }
419 419
             }
420 420
 
Please login to merge, or discard this patch.
examples/Members/member_add_edit_custom_data.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@
 block discarded – undo
24 24
 
25 25
 // Update member
26 26
 $params = Member::fromArray(array (
27
-    "member_id"    => $randomMemberID,
28
-    "custom_data" => array("Custom Key 2" => "Custom Value 2")
27
+	"member_id"    => $randomMemberID,
28
+	"custom_data" => array("Custom Key 2" => "Custom Value 2")
29 29
 ));
30 30
 
31 31
 $response = $member->updateMember($params);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 assert(!is_null($randomMemberID), "There is no member of the type SUB_ACCOUNT_DRIVER in the user's account");
24 24
 
25 25
 // Update member
26
-$params = Member::fromArray(array (
26
+$params = Member::fromArray(array(
27 27
     "member_id"    => $randomMemberID,
28 28
     "custom_data" => array("Custom Key 2" => "Custom Value 2")
29 29
 ));
Please login to merge, or discard this patch.
examples/Addresses/insert_address_into_route_specific_position.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -25,21 +25,21 @@  discard block
 block discarded – undo
25 25
 $addresses = array();
26 26
 
27 27
 $params = array(
28
-    "route_id"  => $routeId,
29
-    "addresses" => array(
30
-        "0" => array(
31
-            "address"      => "Cabo Rojo, Cabo Rojo 00623, Puerto Rico",
32
-            "alias"        => "",
33
-            "lat"          => 18.086627,
34
-            "lng"          => -67.145735,
35
-            "curbside_lat" => 18.086627,
36
-            "curbside_lng" => -67.145735,
37
-            "is_departed"  => false,
38
-            "is_visited"   => false,
39
-            "sequence_no" => 3
40
-        )
41
-    ),
42
-    "optimal_position" => false
28
+	"route_id"  => $routeId,
29
+	"addresses" => array(
30
+		"0" => array(
31
+			"address"      => "Cabo Rojo, Cabo Rojo 00623, Puerto Rico",
32
+			"alias"        => "",
33
+			"lat"          => 18.086627,
34
+			"lng"          => -67.145735,
35
+			"curbside_lat" => 18.086627,
36
+			"curbside_lng" => -67.145735,
37
+			"is_departed"  => false,
38
+			"is_visited"   => false,
39
+			"sequence_no" => 3
40
+		)
41
+	),
42
+	"optimal_position" => false
43 43
 );
44 44
 
45 45
 $route1 = new Route();
@@ -53,5 +53,5 @@  discard block
 block discarded – undo
53 53
 assert(isset($result->addresses), "Can't insert a destination into the route");
54 54
 
55 55
 foreach ($result->addresses as $address) {
56
-    echo "Address -> ".$address->address, ", Sequence number -> ".$address->sequence_no."<br>";
56
+	echo "Address -> ".$address->address, ", Sequence number -> ".$address->sequence_no."<br>";
57 57
 }
Please login to merge, or discard this patch.
src/Route4Me/TelematicsVendor.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -7,64 +7,64 @@  discard block
 block discarded – undo
7 7
 
8 8
 class TelematicsVendor extends Common
9 9
 {
10
-    public $vendor_id; // Telematics Vendor id
11
-    public $is_integrated; // If 1, the vendor is integrated in Route4Me 
12
-    public $page; // starting page
13
-    public $per_page; // Vendors per page in a response
14
-    public $country; // Country Alpha 2 code
15
-    public $feature; // Vendor's feature
16
-    public $search; // Searched text
17
-    public $vendors; // Comma-delimited list of the vendors IDs.
10
+	public $vendor_id; // Telematics Vendor id
11
+	public $is_integrated; // If 1, the vendor is integrated in Route4Me 
12
+	public $page; // starting page
13
+	public $per_page; // Vendors per page in a response
14
+	public $country; // Country Alpha 2 code
15
+	public $feature; // Vendor's feature
16
+	public $search; // Searched text
17
+	public $vendors; // Comma-delimited list of the vendors IDs.
18 18
     
19
-    public static function fromArray(array $params) {
20
-        $vendorsParameters = new TelematicsVendor();
19
+	public static function fromArray(array $params) {
20
+		$vendorsParameters = new TelematicsVendor();
21 21
         
22
-        foreach ($params as $key => $value) {
23
-            if (property_exists($vendorsParameters, $key)) {
24
-                $vendorsParameters->{$key} = $value;
25
-            }
26
-        }
22
+		foreach ($params as $key => $value) {
23
+			if (property_exists($vendorsParameters, $key)) {
24
+				$vendorsParameters->{$key} = $value;
25
+			}
26
+		}
27 27
         
28
-        return $vendorsParameters;
29
-    }
28
+		return $vendorsParameters;
29
+	}
30 30
     
31
-    public static function GetTelematicsVendors($params) {
32
-        Route4Me::setBaseUrl(Endpoint::TELEMATICS_VENDORS);
31
+	public static function GetTelematicsVendors($params) {
32
+		Route4Me::setBaseUrl(Endpoint::TELEMATICS_VENDORS);
33 33
         
34
-        $allQueryFields = array('vendor_id', 'is_integrated', 'page', 'per_page', 'country', 'feature', 'search', 'vendors');
34
+		$allQueryFields = array('vendor_id', 'is_integrated', 'page', 'per_page', 'country', 'feature', 'search', 'vendors');
35 35
 
36
-        $vendors = Route4Me::makeRequst(array(
37
-            'url'    => "",
38
-            'method' => 'GET',
39
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
40
-        ));
36
+		$vendors = Route4Me::makeRequst(array(
37
+			'url'    => "",
38
+			'method' => 'GET',
39
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
40
+		));
41 41
 
42
-        return $vendors;
43
-    }
42
+		return $vendors;
43
+	}
44 44
 
45
-    public static function GetRandomVendorID($offset, $limit) {
46
-        $allVendors  = self::GetTelematicsVendors(null);
47
-        $vendorsNumber = sizeof($allVendors['vendors']);
45
+	public static function GetRandomVendorID($offset, $limit) {
46
+		$allVendors  = self::GetTelematicsVendors(null);
47
+		$vendorsNumber = sizeof($allVendors['vendors']);
48 48
         
49
-        if ($vendorsNumber < $limit) {
50
-            if ($vendorsNumber > $offset) {
51
-                $limit = $vendorsNumber;
52
-            } else {
53
-                if ($vendorsNumber == $offset) {
54
-                    return $allVendors['vendors'][$offset]->{'vendor_id'};
55
-                } else {
56
-                    echo "The vendors numbers are less than offset";
57
-                    return null;
58
-                }
59
-            }
60
-        }
49
+		if ($vendorsNumber < $limit) {
50
+			if ($vendorsNumber > $offset) {
51
+				$limit = $vendorsNumber;
52
+			} else {
53
+				if ($vendorsNumber == $offset) {
54
+					return $allVendors['vendors'][$offset]->{'vendor_id'};
55
+				} else {
56
+					echo "The vendors numbers are less than offset";
57
+					return null;
58
+				}
59
+			}
60
+		}
61 61
         
62
-        $randNumber = rand($offset, $limit);
62
+		$randNumber = rand($offset, $limit);
63 63
         
64
-        return $allVendors['vendors'][$randNumber]['id'];
65
-    }
64
+		return $allVendors['vendors'][$randNumber]['id'];
65
+	}
66 66
     
67
-    /*
67
+	/*
68 68
     public static function GetTelematicsVendor($params) {
69 69
         Route4Me::setBaseUrl(Endpoint::TELEMATICS_VENDORS);
70 70
         
@@ -83,4 +83,4 @@  discard block
 block discarded – undo
83 83
     */
84 84
     
85 85
 }
86
-    
87 86
\ No newline at end of file
87
+	
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,14 +43,14 @@
 block discarded – undo
43 43
     }
44 44
 
45 45
     public static function GetRandomVendorID($offset, $limit) {
46
-        $allVendors  = self::GetTelematicsVendors(null);
46
+        $allVendors = self::GetTelematicsVendors(null);
47 47
         $vendorsNumber = sizeof($allVendors['vendors']);
48 48
         
49
-        if ($vendorsNumber < $limit) {
50
-            if ($vendorsNumber > $offset) {
49
+        if ($vendorsNumber<$limit) {
50
+            if ($vendorsNumber>$offset) {
51 51
                 $limit = $vendorsNumber;
52 52
             } else {
53
-                if ($vendorsNumber == $offset) {
53
+                if ($vendorsNumber==$offset) {
54 54
                     return $allVendors['vendors'][$offset]->{'vendor_id'};
55 55
                 } else {
56 56
                     echo "The vendors numbers are less than offset";
Please login to merge, or discard this patch.
examples/TelematicsVendors/getVendor.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@
 block discarded – undo
18 18
 $randomVendorID = $vendors->GetRandomVendorID(0, 5);
19 19
 
20 20
 $vendorParameters = TelematicsVendor::fromArray(array(
21
-    "vendor_id" => $randomVendorID
21
+	"vendor_id" => $randomVendorID
22 22
 ));
23 23
 
24 24
 $vendor = new TelematicsVendor();
25 25
 $vendorResult = $vendor->GetTelematicsVendors($vendorParameters);
26 26
 
27 27
 Route4Me::simplePrint($vendorResult);
28
-    echo "<br>";
28
+	echo "<br>";
29 29
 
Please login to merge, or discard this patch.