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 ( 71857c...3beb09 )
by Oleg
02:34 queued 25s
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/OptimizationProblem.php 2 patches
Indentation   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -11,236 +11,236 @@
 block discarded – undo
11 11
 
12 12
 class OptimizationProblem extends Common
13 13
 {
14
-    public $optimization_problem_id;
15
-    public $user_errors = array();
16
-    public $state;
17
-    public $optimization_errors = array();
18
-    public $parameters;
19
-    public $sent_to_background;
20
-    public $created_timestamp;
21
-    public $scheduled_for;
22
-    public $optimization_completed_timestamp;
23
-    public $addresses = array();
24
-    public $routes = array();
25
-    public $links = array();
26
-
27
-    function __construct()
28
-    {
29
-        $this->parameters = new RouteParameters;
30
-    }
31
-
32
-    public static function fromArray(array $params)
33
-    {
34
-        $problem = new OptimizationProblem;
35
-        $problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
36
-        $problem->user_errors = Common::getValue($params, 'user_errors', array());
37
-        $problem->state = Common::getValue($params, 'state', array());
38
-        $problem->sent_to_background = Common::getValue($params, 'sent_to_background', array());
39
-        $problem->links = Common::getValue($params, 'links', array());
40
-
41
-        if (isset($params['parameters'])) {
42
-            $problem->parameters = RouteParameters::fromArray($params['parameters']);
43
-        }
44
-
45
-        if (isset($params['addresses'])) {
46
-            $addresses = array();
14
+	public $optimization_problem_id;
15
+	public $user_errors = array();
16
+	public $state;
17
+	public $optimization_errors = array();
18
+	public $parameters;
19
+	public $sent_to_background;
20
+	public $created_timestamp;
21
+	public $scheduled_for;
22
+	public $optimization_completed_timestamp;
23
+	public $addresses = array();
24
+	public $routes = array();
25
+	public $links = array();
26
+
27
+	function __construct()
28
+	{
29
+		$this->parameters = new RouteParameters;
30
+	}
31
+
32
+	public static function fromArray(array $params)
33
+	{
34
+		$problem = new OptimizationProblem;
35
+		$problem->optimization_problem_id = Common::getValue($params, 'optimization_problem_id');
36
+		$problem->user_errors = Common::getValue($params, 'user_errors', array());
37
+		$problem->state = Common::getValue($params, 'state', array());
38
+		$problem->sent_to_background = Common::getValue($params, 'sent_to_background', array());
39
+		$problem->links = Common::getValue($params, 'links', array());
40
+
41
+		if (isset($params['parameters'])) {
42
+			$problem->parameters = RouteParameters::fromArray($params['parameters']);
43
+		}
44
+
45
+		if (isset($params['addresses'])) {
46
+			$addresses = array();
47 47
             
48
-            foreach ($params['addresses'] as $address) {
49
-                $addresses[] = Address::fromArray($address);
50
-            }
48
+			foreach ($params['addresses'] as $address) {
49
+				$addresses[] = Address::fromArray($address);
50
+			}
51 51
             
52
-            $problem->addresses = $addresses;
53
-        }
52
+			$problem->addresses = $addresses;
53
+		}
54 54
 
55
-        if (isset($params['routes'])) {
56
-            $routes = array();
55
+		if (isset($params['routes'])) {
56
+			$routes = array();
57 57
             
58
-            foreach ($params['routes'] as $route) {
59
-                $routes[] = Route::fromArray($route);
60
-            }
58
+			foreach ($params['routes'] as $route) {
59
+				$routes[] = Route::fromArray($route);
60
+			}
61 61
             
62
-            $problem->routes = $routes;
63
-        }
64
-
65
-        return $problem;
66
-    }
67
-
68
-    public static function optimize(OptimizationProblemParams $params)
69
-    {
70
-        $allQueryFields = array('redirect', 'directions', 'format', 'route_path_output', 'optimized_callback_url');
71
-        
72
-        $optimize = Route4Me::makeRequst(array(
73
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
74
-            'method' => 'POST',
75
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
76
-            'body'   => array(
77
-                'addresses'  => $params->getAddressesArray(),
78
-                'parameters' => $params->getParametersArray()
79
-            )
80
-        ));
81
-
82
-        return OptimizationProblem::fromArray($optimize);
83
-    }
84
-
85
-    public static function get($params)
86
-    {
87
-        $allQueryFields = array('state', 'limit', 'format', 'offset', 
88
-        'optimization_problem_id', 'wait_for_final_state');
89
-        
90
-        $optimize = Route4Me::makeRequst(array(
91
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
92
-            'method' => 'GET',
93
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
94
-        ));
95
-
96
-        if (isset($optimize['optimizations'])) {
97
-            $problems = array();
62
+			$problem->routes = $routes;
63
+		}
64
+
65
+		return $problem;
66
+	}
67
+
68
+	public static function optimize(OptimizationProblemParams $params)
69
+	{
70
+		$allQueryFields = array('redirect', 'directions', 'format', 'route_path_output', 'optimized_callback_url');
71
+        
72
+		$optimize = Route4Me::makeRequst(array(
73
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
74
+			'method' => 'POST',
75
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
76
+			'body'   => array(
77
+				'addresses'  => $params->getAddressesArray(),
78
+				'parameters' => $params->getParametersArray()
79
+			)
80
+		));
81
+
82
+		return OptimizationProblem::fromArray($optimize);
83
+	}
84
+
85
+	public static function get($params)
86
+	{
87
+		$allQueryFields = array('state', 'limit', 'format', 'offset', 
88
+		'optimization_problem_id', 'wait_for_final_state');
89
+        
90
+		$optimize = Route4Me::makeRequst(array(
91
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
92
+			'method' => 'GET',
93
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
94
+		));
95
+
96
+		if (isset($optimize['optimizations'])) {
97
+			$problems = array();
98 98
             
99
-            foreach ($optimize['optimizations'] as $problem) {
100
-                $problems[] = OptimizationProblem::fromArray($problem);
101
-            }
99
+			foreach ($optimize['optimizations'] as $problem) {
100
+				$problems[] = OptimizationProblem::fromArray($problem);
101
+			}
102 102
             
103
-            return $problems;
104
-        } else {
105
-            return OptimizationProblem::fromArray($optimize);
106
-        }
107
-    }
108
-
109
-    public static function reoptimize($params)
110
-    {
111
-        $param = new OptimizationProblemParams;
112
-        $param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null;
113
-        $param->reoptimize = 1;
114
-
115
-        return self::update((array)$param);
116
-    }
117
-
118
-    public static function update($params)
119
-    {
120
-        $allQueryFields = array('optimization_problem_id', 'reoptimize');
121
-        $allBodyFields = array('addresses');
122
-        
123
-        $optimize = Route4Me::makeRequst(array(
124
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
125
-            'method' => 'PUT',
126
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
127
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
128
-        ));
129
-        
130
-        return $optimize;
131
-    }
132
-
133
-    public function getOptimizationId()
134
-    {
135
-        return $this->optimization_problem_id;
136
-    }
137
-
138
-    public function getRoutes()
139
-    {
140
-        return $this->routes;
141
-    }
103
+			return $problems;
104
+		} else {
105
+			return OptimizationProblem::fromArray($optimize);
106
+		}
107
+	}
108
+
109
+	public static function reoptimize($params)
110
+	{
111
+		$param = new OptimizationProblemParams;
112
+		$param->optimization_problem_id = isset($params['optimization_problem_id']) ? $params['optimization_problem_id'] : null;
113
+		$param->reoptimize = 1;
114
+
115
+		return self::update((array)$param);
116
+	}
117
+
118
+	public static function update($params)
119
+	{
120
+		$allQueryFields = array('optimization_problem_id', 'reoptimize');
121
+		$allBodyFields = array('addresses');
122
+        
123
+		$optimize = Route4Me::makeRequst(array(
124
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
125
+			'method' => 'PUT',
126
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
127
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
128
+		));
129
+        
130
+		return $optimize;
131
+	}
132
+
133
+	public function getOptimizationId()
134
+	{
135
+		return $this->optimization_problem_id;
136
+	}
137
+
138
+	public function getRoutes()
139
+	{
140
+		return $this->routes;
141
+	}
142 142
     
143
-    public function getRandomOptimizationId($offset, $limit)
144
-    {
145
-        $optimizations = self::get(array('offset' => $offset, 'limit' => $limit));
143
+	public function getRandomOptimizationId($offset, $limit)
144
+	{
145
+		$optimizations = self::get(array('offset' => $offset, 'limit' => $limit));
146 146
             
147
-        $rOptimization = $optimizations[rand(0, sizeof($optimizations) - 1)];
148
-        
149
-        if(!isset($rOptimization->optimization_problem_id)) {
150
-            if (sizeof($optimizations)>9) {
151
-                $this->getRandomOptimizationId($offset, $limit);
152
-            } else {
153
-                return null;
154
-            }
155
-        }
147
+		$rOptimization = $optimizations[rand(0, sizeof($optimizations) - 1)];
148
+        
149
+		if(!isset($rOptimization->optimization_problem_id)) {
150
+			if (sizeof($optimizations)>9) {
151
+				$this->getRandomOptimizationId($offset, $limit);
152
+			} else {
153
+				return null;
154
+			}
155
+		}
156 156
                 
157
-        return $rOptimization->optimization_problem_id;
158
-    }
157
+		return $rOptimization->optimization_problem_id;
158
+	}
159 159
     
160
-    public function getAddresses($opt_id)
161
-    {
162
-        if ($opt_id==null) {
163
-            return null;
164
-        }
160
+	public function getAddresses($opt_id)
161
+	{
162
+		if ($opt_id==null) {
163
+			return null;
164
+		}
165 165
         
166
-        $params = array("optimization_problem_id" => $opt_id);
166
+		$params = array("optimization_problem_id" => $opt_id);
167 167
         
168
-        $optimization = (array)$this->get($params);
168
+		$optimization = (array)$this->get($params);
169 169
         
170
-        $addresses = $optimization["addresses"];
170
+		$addresses = $optimization["addresses"];
171 171
         
172
-        return $addresses;
173
-    }
172
+		return $addresses;
173
+	}
174 174
     
175
-    public function getRandomAddressFromOptimization($opt_id)
176
-    {
177
-        $addresses = (array)$this->getAddresses($opt_id);
175
+	public function getRandomAddressFromOptimization($opt_id)
176
+	{
177
+		$addresses = (array)$this->getAddresses($opt_id);
178 178
         
179
-        if ($addresses==null) {
180
-            echo "There are no addresses in this optimization!.. Try again.";
181
-            return null;
182
-        }
179
+		if ($addresses==null) {
180
+			echo "There are no addresses in this optimization!.. Try again.";
181
+			return null;
182
+		}
183 183
         
184
-        $num = rand(0, sizeof($addresses) - 1);
184
+		$num = rand(0, sizeof($addresses) - 1);
185 185
         
186
-        $rAddress = $addresses[$num];
186
+		$rAddress = $addresses[$num];
187 187
         
188
-        return $rAddress;
189
-    }
188
+		return $rAddress;
189
+	}
190 190
     
191
-    public function removeAddress($params)
192
-    {
193
-        $allQueryFields = array('optimization_problem_id', 'route_destination_id');
194
-        
195
-        $response = Route4Me::makeRequst(array(
196
-            'url'    => Endpoint::ADDRESS_V4,
197
-            'method' => 'DELETE',
198
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
199
-        ));
200
-        
201
-        return $response;
202
-    }
191
+	public function removeAddress($params)
192
+	{
193
+		$allQueryFields = array('optimization_problem_id', 'route_destination_id');
194
+        
195
+		$response = Route4Me::makeRequst(array(
196
+			'url'    => Endpoint::ADDRESS_V4,
197
+			'method' => 'DELETE',
198
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
199
+		));
200
+        
201
+		return $response;
202
+	}
203 203
     
204
-    public function removeOptimization($params)
205
-    {
206
-        $allQueryFields = array('redirect');
207
-        $allBodyFields = array('optimization_problem_ids');
208
-        
209
-        $response = Route4Me::makeRequst(array(
210
-            'url'    => Endpoint::OPTIMIZATION_PROBLEM,
211
-            'method' => 'DELETE',
212
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
213
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
214
-        ));
215
-        
216
-        return $response;
217
-    }
204
+	public function removeOptimization($params)
205
+	{
206
+		$allQueryFields = array('redirect');
207
+		$allBodyFields = array('optimization_problem_ids');
208
+        
209
+		$response = Route4Me::makeRequst(array(
210
+			'url'    => Endpoint::OPTIMIZATION_PROBLEM,
211
+			'method' => 'DELETE',
212
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
213
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
214
+		));
215
+        
216
+		return $response;
217
+	}
218 218
     
219
-    public function getHybridOptimization($params)
220
-    {
221
-        $allQueryFields = array('target_date_string', 'timezone_offset_minutes');
222
-        
223
-        $optimize = Route4Me::makeRequst(array(
224
-            'url'    => Endpoint::HYBRID_DATE_OPTIMIZATION,
225
-            'method' => 'GET',
226
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
227
-        ));
228
-
229
-        return $optimize;
230
-    }
219
+	public function getHybridOptimization($params)
220
+	{
221
+		$allQueryFields = array('target_date_string', 'timezone_offset_minutes');
222
+        
223
+		$optimize = Route4Me::makeRequst(array(
224
+			'url'    => Endpoint::HYBRID_DATE_OPTIMIZATION,
225
+			'method' => 'GET',
226
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params)
227
+		));
228
+
229
+		return $optimize;
230
+	}
231 231
     
232
-    Public function addDepotsToHybrid($params)
233
-    {
234
-        $allQueryFields = array('optimization_problem_id');
235
-        $allBodyFields = array('optimization_problem_id', 'delete_old_depots', 'new_depots');
236
-        
237
-        $depots = Route4Me::makeRequst(array( 
238
-            'url'    => Endpoint::CHANGE_HYBRID_OPTIMIZATION_DEPOT,
239
-            'method' => 'POST',
240
-            'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
241
-            'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
242
-        ));
243
-        
244
-        return $depots;
245
-    }
232
+	Public function addDepotsToHybrid($params)
233
+	{
234
+		$allQueryFields = array('optimization_problem_id');
235
+		$allBodyFields = array('optimization_problem_id', 'delete_old_depots', 'new_depots');
236
+        
237
+		$depots = Route4Me::makeRequst(array( 
238
+			'url'    => Endpoint::CHANGE_HYBRID_OPTIMIZATION_DEPOT,
239
+			'method' => 'POST',
240
+			'query'  => Route4Me::generateRequestParameters($allQueryFields, $params),
241
+			'body'   => Route4Me::generateRequestParameters($allBodyFields, $params)
242
+		));
243
+        
244
+		return $depots;
245
+	}
246 246
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@
 block discarded – undo
146 146
             
147 147
         $rOptimization = $optimizations[rand(0, sizeof($optimizations) - 1)];
148 148
         
149
-        if(!isset($rOptimization->optimization_problem_id)) {
149
+        if (!isset($rOptimization->optimization_problem_id)) {
150 150
             if (sizeof($optimizations)>9) {
151 151
                 $this->getRandomOptimizationId($offset, $limit);
152 152
             } else {
Please login to merge, or discard this patch.