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 ( 22c278...8077f9 )
by Oleg
02:37
created
examples/Tracking/GetDeviceTrackingHistoryFromTimeRange.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
 // Set GPS postion to the selected route
28 28
 // Set right member_id corresponding to the API key
29 29
 $params = TrackSetParams::fromArray(array(
30
-    'format'           => Format::SERIALIZED,
31
-    'route_id'         => $routeId,
32
-    'member_id'        => 1,
33
-    'course'           => 1,
34
-    'speed'            => 120,
35
-    'lat'              => 41.8927521,
36
-    'lng'              => -109.0803888,
37
-    'device_type'      => 'android_phone',
38
-    'device_guid'      => 'qweqweqwe',
39
-    'device_timestamp' => date('Y-m-d H:i:s', strtotime('-2 day'))
30
+	'format'           => Format::SERIALIZED,
31
+	'route_id'         => $routeId,
32
+	'member_id'        => 1,
33
+	'course'           => 1,
34
+	'speed'            => 120,
35
+	'lat'              => 41.8927521,
36
+	'lng'              => -109.0803888,
37
+	'device_type'      => 'android_phone',
38
+	'device_guid'      => 'qweqweqwe',
39
+	'device_timestamp' => date('Y-m-d H:i:s', strtotime('-2 day'))
40 40
 ));
41 41
 
42 42
 $status = Track::set($params);
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
 $endDate = time() + 1 * 24 * 3600;
51 51
 
52 52
 $params = array(
53
-    'route_id'     => $routeId,
54
-    'format'       => Format::JSON,
55
-    'time_period'  => 'custom',
56
-    'start_date'   => $startDate,
57
-    'end_date'     => $endDate
53
+	'route_id'     => $routeId,
54
+	'format'       => Format::JSON,
55
+	'time_period'  => 'custom',
56
+	'start_date'   => $startDate,
57
+	'end_date'     => $endDate
58 58
 );
59 59
 
60 60
 $result = $route->GetTrackingHistoryFromTimeRange($params);
61 61
 
62 62
 foreach ($result as $key => $value)
63 63
 {
64
-    if (is_array($value)) {
65
-        Route4Me::simplePrint($value);
66
-    } else {
67
-        echo "$key => $value <br>";
68
-    }
64
+	if (is_array($value)) {
65
+		Route4Me::simplePrint($value);
66
+	} else {
67
+		echo "$key => $value <br>";
68
+	}
69 69
 }
Please login to merge, or discard this patch.
examples/Order/RemoveOrder.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@
 block discarded – undo
29 29
 
30 30
 // Remove 2 random orders
31 31
 $orderParameters = Order::fromArray(array(
32
-    'order_ids' => array(
33
-        0 => $randomOrderID1,
34
-        1 => $randomOrderID2,
35
-      )
32
+	'order_ids' => array(
33
+		0 => $randomOrderID1,
34
+		1 => $randomOrderID2,
35
+	  )
36 36
 ));
37 37
 
38 38
 $response = $order->removeOrder($orderParameters);
Please login to merge, or discard this patch.
examples/Notes/GetAddressNotes.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
 
29 29
 // Add an address note
30 30
 $noteParameters = array(
31
-    "route_id"        => $route_id,
32
-    "address_id"      => $route_destination_id,
33
-    "dev_lat"         => 33.132675170898,
34
-    "dev_lng"         => -83.244743347168,
35
-    "device_type"     => "web",
36
-    "strUpdateType"   => "dropoff",
37
-    "strNoteContents" => "Test ".time()
31
+	"route_id"        => $route_id,
32
+	"address_id"      => $route_destination_id,
33
+	"dev_lat"         => 33.132675170898,
34
+	"dev_lng"         => -83.244743347168,
35
+	"device_type"     => "web",
36
+	"strUpdateType"   => "dropoff",
37
+	"strNoteContents" => "Test ".time()
38 38
 );
39 39
 
40 40
 $address = new Address();
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 
46 46
 // Get address notes
47 47
 $noteParameters = array(
48
-    "route_id"              => $route_id,
49
-    "route_destination_id"  => $route_destination_id
48
+	"route_id"              => $route_id,
49
+	"route_destination_id"  => $route_destination_id
50 50
 );
51 51
 
52 52
 $address = new Address();
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
 echo "Destination note count --> ".$notes['destination_note_count']."<br>";
57 57
 
58 58
 foreach ($notes['notes'] as $note) {
59
-    echo "========== Notes ==================<br>";
60
-    echo "note_id --> ".$note['note_id']."<br>";
61
-    $content = isset($note['contents']) ? $note['contents'] : "";
62
-    if (strlen($content)>0) {
63
-        echo "contents --> $content"."<br>";
64
-    }
59
+	echo "========== Notes ==================<br>";
60
+	echo "note_id --> ".$note['note_id']."<br>";
61
+	$content = isset($note['contents']) ? $note['contents'] : "";
62
+	if (strlen($content)>0) {
63
+		echo "contents --> $content"."<br>";
64
+	}
65 65
 }
Please login to merge, or discard this patch.
examples/Territories/AddTerritory.php 1 patch
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.
examples/Geocoding/reverse_geocode.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
 Route4Me::setApiKey('11111111111111111111111111111111');
12 12
 
13 13
 $geocodingParameters = array(
14
-    'format'    => 'xml',
15
-    'addresses' => '42.35863,-71.05670'
14
+	'format'    => 'xml',
15
+	'addresses' => '42.35863,-71.05670'
16 16
 );
17 17
 
18 18
 $fGeoCoding = new Geocoding();
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 $fgResult = $fGeoCoding->reverseGeocoding($geocodingParameters);
21 21
 
22 22
 if ($geocodingParameters['format']=='json') {
23
-    foreach ($fgResult as $dest) {
24
-        Route4Me::simplePrint($dest);
25
-        echo "<br>";
26
-    }
23
+	foreach ($fgResult as $dest) {
24
+		Route4Me::simplePrint($dest);
25
+		echo "<br>";
26
+	}
27 27
 } else {
28
-    foreach ($fgResult['destination'] as $dest) {
29
-        Route4Me::simplePrint($dest);
30
-        echo "<br>";
31
-    }
28
+	foreach ($fgResult['destination'] as $dest) {
29
+		Route4Me::simplePrint($dest);
30
+		echo "<br>";
31
+	}
32 32
 }
Please login to merge, or discard this patch.
examples/AvoidanceZones/DeleteAvoidanceZone.php 1 patch
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
 $AvoisanceZoneParameters = AvoidanceZone::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
 $avoidancezone = new AvoidanceZone();
Please login to merge, or discard this patch.
examples/Addresses/MoveDestinationToRoute.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 $route = new Route();
17 17
 
18 18
 $grParams = array(
19
-    'offset' => 0,
20
-    'limit'  => 10
19
+	'offset' => 0,
20
+	'limit'  => 10
21 21
 );
22 22
 
23 23
 $routes = $route->getRoutes($grParams);
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 echo "<br> From the route -> ".$route_id0."<br>";
33 33
 
34 34
 if (is_null($route_id0)) {
35
-    echo "Can't retrieve random route_id!.. Try again.";
36
-    return;
35
+	echo "Can't retrieve random route_id!.. Try again.";
36
+	return;
37 37
 }
38 38
 
39 39
 // Get random source destination from selected source route above
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
 $to_route_id = $route_id0;
49 49
 
50 50
 while ($to_route_id==$route_id0) {
51
-    $to_route_id = $routes[rand(0, sizeof($routes) - 1)]->route_id;
51
+	$to_route_id = $routes[rand(0, sizeof($routes) - 1)]->route_id;
52 52
 }
53 53
 
54 54
 echo "<br> to the route -> ".$to_route_id."<br>";
55 55
 
56 56
 if (is_null($to_route_id)) {
57
-    echo "Can't retrieve random route_id!.. Try again.";
58
-    return;
57
+	echo "Can't retrieve random route_id!.. Try again.";
58
+	return;
59 59
 }
60 60
 
61 61
 // Get random destination destination from selected source route above
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
 $after_destination_id = $addressRand2['route_destination_id'];
65 65
 
66 66
 if (is_null($after_destination_id)) {
67
-    echo "can't retrieve random address!.. Try again.";
68
-    return;
67
+	echo "can't retrieve random address!.. Try again.";
68
+	return;
69 69
 }
70 70
 
71 71
 echo "after_destination_id = $after_destination_id <br>";
72 72
 
73 73
 // Move the destination to the route     
74 74
 $routeparams = array(
75
-    'to_route_id'           =>  $to_route_id,
76
-    'route_destination_id'  =>  strval($route_destination_id),
77
-    'after_destination_id'  =>  strval($after_destination_id)
75
+	'to_route_id'           =>  $to_route_id,
76
+	'route_destination_id'  =>  strval($route_destination_id),
77
+	'after_destination_id'  =>  strval($after_destination_id)
78 78
 );
79 79
 
80 80
 $address = new Address();
Please login to merge, or discard this patch.
examples/Addresses/RemoveDestinationFromOptimization.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 assert(!is_null($addressRand), "Can't retrieve random address");
28 28
 
29 29
 if (isset($addressRand['is_depot'])) {
30
-    if ($addressRand['is_depot']) {
31
-        echo "This address is depot!.. Try again.";
32
-        return;
33
-    }
30
+	if ($addressRand['is_depot']) {
31
+		echo "This address is depot!.. Try again.";
32
+		return;
33
+	}
34 34
 }
35 35
 
36 36
 $route_destination_id = $addressRand['route_destination_id'];
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
 // Remove the destination from the optimization
41 41
 $params = array(
42
-    "optimization_problem_id"  => $optimization_problem_id,
43
-    "route_destination_id"     => $route_destination_id
42
+	"optimization_problem_id"  => $optimization_problem_id,
43
+	"route_destination_id"     => $route_destination_id
44 44
 );
45 45
 
46 46
 $result = $optimization->removeAddress($params);
Please login to merge, or discard this patch.
src/Route4Me/Order.php 1 patch
Indentation   +251 added lines, -251 removed lines patch added patch discarded remove patch
@@ -6,324 +6,324 @@
 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 $addresses = array();
63
+	public $addresses = array();
64 64
     
65
-    public static function fromArray(array $params) {
66
-        $order = new Order();
67
-        foreach ($params as $key => $value) {
68
-            if (property_exists($order, $key)) {
69
-                $order->{$key} = $value;
70
-            }
71
-        }
65
+	public static function fromArray(array $params) {
66
+		$order = new Order();
67
+		foreach ($params as $key => $value) {
68
+			if (property_exists($order, $key)) {
69
+				$order->{$key} = $value;
70
+			}
71
+		}
72 72
         
73
-        return $order;
74
-    }
73
+		return $order;
74
+	}
75 75
     
76
-    /**
77
-     * @param Order $params
78
-     */
79
-    public static function addOrder($params)
80
-    {
81
-        $excludeFields = array('route_id', 'redirect', 'optimization_problem_id', 'order_id', 
82
-        'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp');
76
+	/**
77
+	 * @param Order $params
78
+	 */
79
+	public static function addOrder($params)
80
+	{
81
+		$excludeFields = array('route_id', 'redirect', 'optimization_problem_id', 'order_id', 
82
+		'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp');
83 83
         
84
-        $allBodyFields = Route4Me::getObjectProperties(new Order(), $excludeFields);
84
+		$allBodyFields = Route4Me::getObjectProperties(new Order(), $excludeFields);
85 85
         
86
-        $response = Route4Me::makeRequst(array(
87
-            'url'    => Endpoint::ORDER_V4,
88
-            'method' => 'POST',
89
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
90
-        ));
86
+		$response = Route4Me::makeRequst(array(
87
+			'url'    => Endpoint::ORDER_V4,
88
+			'method' => 'POST',
89
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
90
+		));
91 91
 
92
-        return $response;
93
-    }
92
+		return $response;
93
+	}
94 94
 
95
-    public static function addOrder2Route($params)
96
-    {
97
-        $allQueryFields = array('route_id', 'redirect');
98
-        $allBodyFields = array('addresses');
95
+	public static function addOrder2Route($params)
96
+	{
97
+		$allQueryFields = array('route_id', 'redirect');
98
+		$allBodyFields = array('addresses');
99 99
         
100
-        $response = Route4Me::makeRequst(array(
101
-            'url'    => Endpoint::ROUTE_V4,
102
-            'method' => 'PUT',
103
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
104
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
105
-        ));
100
+		$response = Route4Me::makeRequst(array(
101
+			'url'    => Endpoint::ROUTE_V4,
102
+			'method' => 'PUT',
103
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
104
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
105
+		));
106 106
 
107
-        return $response;
108
-    }
107
+		return $response;
108
+	}
109 109
     
110
-    public static function addOrder2Optimization($params)
111
-    {
112
-        $allQueryFields = array('optimization_problem_id', 'redirect', 'device_type');
113
-        $allBodyFields = array('addresses');
110
+	public static function addOrder2Optimization($params)
111
+	{
112
+		$allQueryFields = array('optimization_problem_id', 'redirect', 'device_type');
113
+		$allBodyFields = array('addresses');
114 114
         
115
-        $response = Route4Me::makeRequst(array(
116
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
117
-            'method' => 'PUT',
118
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
119
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
120
-        ));
115
+		$response = Route4Me::makeRequst(array(
116
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
117
+			'method' => 'PUT',
118
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
119
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
120
+		));
121 121
 
122
-        return $response;
123
-    }
122
+		return $response;
123
+	}
124 124
     
125
-    public static function getOrder($params)
126
-    {
127
-        $allQueryFields = array('order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit');
125
+	public static function getOrder($params)
126
+	{
127
+		$allQueryFields = array('order_id', 'fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit');
128 128
 
129
-        $response = Route4Me::makeRequst(array(
130
-            'url'    => Endpoint::ORDER_V4,
131
-            'method' => 'GET',
132
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
133
-        ));
129
+		$response = Route4Me::makeRequst(array(
130
+			'url'    => Endpoint::ORDER_V4,
131
+			'method' => 'GET',
132
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
133
+		));
134 134
 
135
-        return $response;
136
-    }
135
+		return $response;
136
+	}
137 137
     
138
-    public static function getOrders($params)
139
-    {
140
-        $allQueryFields = array('offset', 'limit');
138
+	public static function getOrders($params)
139
+	{
140
+		$allQueryFields = array('offset', 'limit');
141 141
         
142
-        $response = Route4Me::makeRequst(array(
143
-            'url'    => Endpoint::ORDER_V4,
144
-            'method' => 'GET',
145
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
146
-        ));
142
+		$response = Route4Me::makeRequst(array(
143
+			'url'    => Endpoint::ORDER_V4,
144
+			'method' => 'GET',
145
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
146
+		));
147 147
 
148
-        return $response;
149
-    }
148
+		return $response;
149
+	}
150 150
     
151
-    public function getRandomOrderId($offset, $limit)
152
-    {
153
-        $randomOrder = $this->getRandomOrder($offset, $limit);
151
+	public function getRandomOrderId($offset, $limit)
152
+	{
153
+		$randomOrder = $this->getRandomOrder($offset, $limit);
154 154
         
155
-        if (is_null($randomOrder) || !isset($randomOrder)) {
156
-            return null;
157
-        }
155
+		if (is_null($randomOrder) || !isset($randomOrder)) {
156
+			return null;
157
+		}
158 158
         
159
-        return $randomOrder['order_id'];
160
-    }
159
+		return $randomOrder['order_id'];
160
+	}
161 161
     
162
-    public function getRandomOrder($offset, $limit)
163
-    {
164
-        $params = array('offset' => $offset, 'limit' => $limit);
162
+	public function getRandomOrder($offset, $limit)
163
+	{
164
+		$params = array('offset' => $offset, 'limit' => $limit);
165 165
         
166
-        $orders = self::getOrders($params);
166
+		$orders = self::getOrders($params);
167 167
         
168
-        if (is_null($orders) || !isset($orders['results'])) {
169
-            return null;
170
-        }
168
+		if (is_null($orders) || !isset($orders['results'])) {
169
+			return null;
170
+		}
171 171
         
172
-        $randomIndex = rand(0, sizeof($orders['results']) - 1);
172
+		$randomIndex = rand(0, sizeof($orders['results']) - 1);
173 173
         
174
-        $order = $orders['results'][$randomIndex];
174
+		$order = $orders['results'][$randomIndex];
175 175
         
176
-        return $order;
177
-    }
176
+		return $order;
177
+	}
178 178
     
179
-    public static function removeOrder($params)
180
-    {
181
-        $allBodyFields = array('order_ids');
179
+	public static function removeOrder($params)
180
+	{
181
+		$allBodyFields = array('order_ids');
182 182
         
183
-        $response = Route4Me::makeRequst(array(
184
-            'url'    => Endpoint::ORDER_V4,
185
-            'method' => 'DELETE',
186
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
187
-        ));
183
+		$response = Route4Me::makeRequst(array(
184
+			'url'    => Endpoint::ORDER_V4,
185
+			'method' => 'DELETE',
186
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
187
+		));
188 188
 
189
-        return $response;
190
-    }
189
+		return $response;
190
+	}
191 191
     
192
-    public static function updateOrder($params)
193
-    {
194
-        $excludeFields = array('route_id', 'redirect', 'optimization_problem_id', 
195
-        'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp');
192
+	public static function updateOrder($params)
193
+	{
194
+		$excludeFields = array('route_id', 'redirect', 'optimization_problem_id', 
195
+		'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp');
196 196
         
197
-        $allBodyFields = Route4Me::getObjectProperties(new Order(), $excludeFields);
197
+		$allBodyFields = Route4Me::getObjectProperties(new Order(), $excludeFields);
198 198
         
199
-        $response = Route4Me::makeRequst(array(
200
-            'url'    => Endpoint::ORDER_V4,
201
-            'method' => 'PUT',
202
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
203
-        ));
199
+		$response = Route4Me::makeRequst(array(
200
+			'url'    => Endpoint::ORDER_V4,
201
+			'method' => 'PUT',
202
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
203
+		));
204 204
 
205
-        return $response;
206
-    }
205
+		return $response;
206
+	}
207 207
     
208
-    public static function searchOrder($params)
209
-    {
210
-        $allQueryFields = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' );
208
+	public static function searchOrder($params)
209
+	{
210
+		$allQueryFields = array('fields', 'day_added_YYMMDD', 'scheduled_for_YYMMDD', 'query', 'offset', 'limit' );
211 211
         
212
-        $response = Route4Me::makeRequst(array(
213
-            'url'    => Endpoint::ORDER_V4,
214
-            'method' => 'GET',
215
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
216
-        ));
212
+		$response = Route4Me::makeRequst(array(
213
+			'url'    => Endpoint::ORDER_V4,
214
+			'method' => 'GET',
215
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
216
+		));
217 217
 
218
-        return $response;
219
-    }
218
+		return $response;
219
+	}
220 220
     
221
-    public static function validateCoordinate($coord)
222
-    {
223
-        $key = key($coord);
221
+	public static function validateCoordinate($coord)
222
+	{
223
+		$key = key($coord);
224 224
         
225
-        if (!is_numeric($coord[$key])) {
226
-            return false;
227
-        }
225
+		if (!is_numeric($coord[$key])) {
226
+			return false;
227
+		}
228 228
         
229
-        switch ($key) {
230
-        case 'cached_lat':
231
-        case 'curbside_lat':
232
-            if ($coord[$key]>90 || $coord[$key]<-90) {
233
-                return false;
234
-            }
235
-            break;
236
-        case 'cached_lng':
237
-        case 'curbside_lng':
238
-            if ($coord[$key]>180 || $coord[$key]<-180) {
239
-                return false;
240
-            }
241
-            break;
242
-        }
229
+		switch ($key) {
230
+		case 'cached_lat':
231
+		case 'curbside_lat':
232
+			if ($coord[$key]>90 || $coord[$key]<-90) {
233
+				return false;
234
+			}
235
+			break;
236
+		case 'cached_lng':
237
+		case 'curbside_lng':
238
+			if ($coord[$key]>180 || $coord[$key]<-180) {
239
+				return false;
240
+			}
241
+			break;
242
+		}
243 243
         
244
-        return true;
245
-    }
244
+		return true;
245
+	}
246 246
     
247
-    public function addOrdersFromCsvFile($csvFileHandle, $ordersFieldsMapping)
248
-    {
249
-        $max_line_length = 512;
250
-        $delemietr = ',';
247
+	public function addOrdersFromCsvFile($csvFileHandle, $ordersFieldsMapping)
248
+	{
249
+		$max_line_length = 512;
250
+		$delemietr = ',';
251 251
         
252
-        $results = array();
253
-        $results['fail'] = array();
254
-        $results['success'] = array();
252
+		$results = array();
253
+		$results['fail'] = array();
254
+		$results['success'] = array();
255 255
         
256
-        $columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
256
+		$columns = fgetcsv($csvFileHandle, $max_line_length, $delemietr);
257 257
         
258
-        $excludeFields = array('route_id', 'redirect', 'optimization_problem_id', 'order_id', 
259
-        'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp');
258
+		$excludeFields = array('route_id', 'redirect', 'optimization_problem_id', 'order_id', 
259
+		'order_ids', 'fields', 'offset', 'limit', 'query', 'created_timestamp');
260 260
         
261
-        $allOrderFields = Route4Me::getObjectProperties(new Order(), $excludeFields);
261
+		$allOrderFields = Route4Me::getObjectProperties(new Order(), $excludeFields);
262 262
         
263
-        if (!empty($columns)) {
264
-             array_push($results['fail'],'Empty CSV table');
265
-             return ($results);
266
-        }
263
+		if (!empty($columns)) {
264
+			 array_push($results['fail'],'Empty CSV table');
265
+			 return ($results);
266
+		}
267 267
                  
268
-        $iRow=1;
268
+		$iRow=1;
269 269
         
270
-        while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
271
-            if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null)!==$rows) {
270
+		while (($rows = fgetcsv($csvFileHandle, $max_line_length, $delemietr))!==false) {
271
+			if ($rows[$ordersFieldsMapping['cached_lat']] && $rows[$ordersFieldsMapping['cached_lng']] && $rows[$ordersFieldsMapping['address_1']] && array(null)!==$rows) {
272 272
                 
273
-                $cached_lat = 0.000;
274
-                $cached_lng = 0.000;
273
+				$cached_lat = 0.000;
274
+				$cached_lng = 0.000;
275 275
                 
276
-                foreach (array('cached_lat', 'cached_lng', 'curbside_lat', 'curbside_lng') as $coord) {
277
-                    if (!$this->validateCoordinate(array($coord => $rows[$ordersFieldsMapping[$coord]]))) {
278
-                        array_push($results['fail'], "$iRow --> Wrong "+$coord); 
279
-                        $iRow++;
280
-                        continue;
281
-                    } else {
282
-                        switch ($coord) {
283
-                        case 'cached_lat':
284
-                            $cached_lat = doubleval($rows[$ordersFieldsMapping[$coord]]);
285
-                            break;
286
-                        case 'cached_lng':
287
-                            $cached_lng = doubleval($rows[$ordersFieldsMapping[$coord]]);
288
-                            break;
289
-                        }
290
-                    }
291
-                }
276
+				foreach (array('cached_lat', 'cached_lng', 'curbside_lat', 'curbside_lng') as $coord) {
277
+					if (!$this->validateCoordinate(array($coord => $rows[$ordersFieldsMapping[$coord]]))) {
278
+						array_push($results['fail'], "$iRow --> Wrong "+$coord); 
279
+						$iRow++;
280
+						continue;
281
+					} else {
282
+						switch ($coord) {
283
+						case 'cached_lat':
284
+							$cached_lat = doubleval($rows[$ordersFieldsMapping[$coord]]);
285
+							break;
286
+						case 'cached_lng':
287
+							$cached_lng = doubleval($rows[$ordersFieldsMapping[$coord]]);
288
+							break;
289
+						}
290
+					}
291
+				}
292 292
                 
293
-                $address = $rows[$ordersFieldsMapping['address_1']];
293
+				$address = $rows[$ordersFieldsMapping['address_1']];
294 294
                 
295
-                foreach (array('order_city', 'order_state_id', 'order_zip_code', 'order_country_id') as $addressPart) {
296
-                    if (isset($ordersFieldsMapping[$addressPart])) {
297
-                        $address .= ', '.$rows[$ordersFieldsMapping[$addressPart]];
298
-                    }
299
-                }
295
+				foreach (array('order_city', 'order_state_id', 'order_zip_code', 'order_country_id') as $addressPart) {
296
+					if (isset($ordersFieldsMapping[$addressPart])) {
297
+						$address .= ', '.$rows[$ordersFieldsMapping[$addressPart]];
298
+					}
299
+				}
300 300
 
301
-                echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].", ".$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']]."<br>";
301
+				echo "$iRow --> ".$ordersFieldsMapping['day_scheduled_for_YYMMDD'].", ".$rows[$ordersFieldsMapping['day_scheduled_for_YYMMDD']]."<br>";
302 302
                 
303
-                $parametersArray = array();
303
+				$parametersArray = array();
304 304
                 
305
-                $parametersArray["cached_lat"] = $cached_lat;
306
-                $parametersArray["cached_lng"] = $cached_lng;
305
+				$parametersArray["cached_lat"] = $cached_lat;
306
+				$parametersArray["cached_lng"] = $cached_lng;
307 307
                 
308 308
                 
309
-                foreach ($allOrderFields as $orderField) {
310
-                    if (isset($ordersFieldsMapping[$orderField])) {
311
-                        $parametersArray[$orderField] = $rows[$ordersFieldsMapping[$orderField]];
312
-                    }
313
-                }
309
+				foreach ($allOrderFields as $orderField) {
310
+					if (isset($ordersFieldsMapping[$orderField])) {
311
+						$parametersArray[$orderField] = $rows[$ordersFieldsMapping[$orderField]];
312
+					}
313
+				}
314 314
                 
315
-                $orderParameters = Order::fromArray($parametersArray);
315
+				$orderParameters = Order::fromArray($parametersArray);
316 316
 
317
-                $order = new Order();
317
+				$order = new Order();
318 318
                 
319
-                $orderResults = $order->addOrder($orderParameters);
319
+				$orderResults = $order->addOrder($orderParameters);
320 320
                 
321
-                array_push($results['success'], "The order with order_id = ".strval($orderResults["order_id"])." added successfuly.");
322
-            } else {
323
-                array_push($results['fail'], "$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); 
324
-            }
321
+				array_push($results['success'], "The order with order_id = ".strval($orderResults["order_id"])." added successfuly.");
322
+			} else {
323
+				array_push($results['fail'], "$iRow --> one of the parameters cached_lat, cached_lng, address_1 is not set"); 
324
+			}
325 325
             
326
-            $iRow++;
327
-        }
328
-    }
326
+			$iRow++;
327
+		}
328
+	}
329 329
 }
Please login to merge, or discard this patch.