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
src/Route4Me/AvoidanceZone.php 1 patch
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -7,111 +7,111 @@
 block discarded – undo
7 7
 
8 8
 class AvoidanceZone extends Common
9 9
 {
10
-    public $territory_id; // Avoidance zone id
11
-    public $territory_name; 
12
-    public $territory_color;
13
-    public $orders;
14
-    public $member_id;
15
-    public $territory; // Territory parameters
10
+	public $territory_id; // Avoidance zone id
11
+	public $territory_name; 
12
+	public $territory_color;
13
+	public $orders;
14
+	public $member_id;
15
+	public $territory; // Territory parameters
16 16
     
17
-    public static function fromArray(array $params) 
18
-    {
19
-        if (!isset($params['territory_name'])) {
20
-            throw new BadParam('Territory name must be provided');
21
-        }
17
+	public static function fromArray(array $params) 
18
+	{
19
+		if (!isset($params['territory_name'])) {
20
+			throw new BadParam('Territory name must be provided');
21
+		}
22 22
         
23
-        if (!isset($params['territory_color'])) {
24
-            throw new BadParam('Territory color must be provided');
25
-        }
23
+		if (!isset($params['territory_color'])) {
24
+			throw new BadParam('Territory color must be provided');
25
+		}
26 26
         
27
-        if (!isset($params['territory'])) {
28
-            throw new BadParam('Territory must be provided');
29
-        }
27
+		if (!isset($params['territory'])) {
28
+			throw new BadParam('Territory must be provided');
29
+		}
30 30
         
31
-        $avoidanceZoneParameters = new AvoidanceZone();
31
+		$avoidanceZoneParameters = new AvoidanceZone();
32 32
         
33
-        foreach ($params as $key => $value) {
34
-            if (property_exists($avoidanceZoneParameters, $key)) {
35
-                $avoidanceZoneParameters->{$key} = $value;
36
-            }
37
-        }
33
+		foreach ($params as $key => $value) {
34
+			if (property_exists($avoidanceZoneParameters, $key)) {
35
+				$avoidanceZoneParameters->{$key} = $value;
36
+			}
37
+		}
38 38
         
39
-        return $avoidanceZoneParameters;
40
-    }
39
+		return $avoidanceZoneParameters;
40
+	}
41 41
     
42
-    public static function getAvoidanceZone($territory_id)
43
-    {
44
-        $avoidanceZone = Route4Me::makeRequst(array(
45
-            'url'    => Endpoint::AVOIDANCE_ZONE,
46
-            'method' => 'GET',
47
-            'query'  => array(
48
-                'territory_id' => $territory_id
49
-            )
50
-        ));
42
+	public static function getAvoidanceZone($territory_id)
43
+	{
44
+		$avoidanceZone = Route4Me::makeRequst(array(
45
+			'url'    => Endpoint::AVOIDANCE_ZONE,
46
+			'method' => 'GET',
47
+			'query'  => array(
48
+				'territory_id' => $territory_id
49
+			)
50
+		));
51 51
 
52
-        return $avoidanceZone;
53
-    }
52
+		return $avoidanceZone;
53
+	}
54 54
     
55
-    public static function getAvoidanceZones($params)
56
-    {
57
-        $avoidanceZones = Route4Me::makeRequst(array(
58
-            'url'    => Endpoint::AVOIDANCE_ZONE,
59
-            'method' => 'GET',
60
-            'query'  => array(
61
-                'offset'  => isset($params->offset) ? $params->offset : null,
62
-                'limit'   => isset($params->limit) ? $params->limit : null,
63
-            )
64
-        ));
55
+	public static function getAvoidanceZones($params)
56
+	{
57
+		$avoidanceZones = Route4Me::makeRequst(array(
58
+			'url'    => Endpoint::AVOIDANCE_ZONE,
59
+			'method' => 'GET',
60
+			'query'  => array(
61
+				'offset'  => isset($params->offset) ? $params->offset : null,
62
+				'limit'   => isset($params->limit) ? $params->limit : null,
63
+			)
64
+		));
65 65
 
66
-        return $avoidanceZones;
67
-    }
66
+		return $avoidanceZones;
67
+	}
68 68
 
69
-    public static function addAvoidanceZone($params)
70
-    {
71
-        $terParams = array();
69
+	public static function addAvoidanceZone($params)
70
+	{
71
+		$terParams = array();
72 72
 
73
-        if (isset($params->territory['type'])) {
74
-            $terParams['type'] = $params->territory['type'];
75
-        }
73
+		if (isset($params->territory['type'])) {
74
+			$terParams['type'] = $params->territory['type'];
75
+		}
76 76
         
77
-        if (isset($params->territory['data'])) {
78
-            $terParams['data'] = $params->territory['data'];
79
-        }
77
+		if (isset($params->territory['data'])) {
78
+			$terParams['data'] = $params->territory['data'];
79
+		}
80 80
 
81
-        $abContacts = Route4Me::makeRequst(array(
82
-            'url'    => Endpoint::AVOIDANCE_ZONE,
83
-            'method' => 'POST',
84
-            'body'  => array(
85
-                'territory_name'  => isset($params->territory_name) ? $params->territory_name : null,
86
-                'territory_color' => isset($params->territory_color) ? $params->territory_color : null,
87
-                'territory'       => $terParams
88
-            )
89
-        ));
81
+		$abContacts = Route4Me::makeRequst(array(
82
+			'url'    => Endpoint::AVOIDANCE_ZONE,
83
+			'method' => 'POST',
84
+			'body'  => array(
85
+				'territory_name'  => isset($params->territory_name) ? $params->territory_name : null,
86
+				'territory_color' => isset($params->territory_color) ? $params->territory_color : null,
87
+				'territory'       => $terParams
88
+			)
89
+		));
90 90
 
91
-        return $abContacts;
92
-    }
91
+		return $abContacts;
92
+	}
93 93
     
94
-    public function deleteAvoidanceZone($territory_id)
95
-    {
96
-        $result = Route4Me::makeRequst(array(
97
-            'url'    => Endpoint::AVOIDANCE_ZONE,
98
-            'method' => 'DELETEARRAY',
99
-            'query'  => array(
100
-                'territory_id' => $territory_id
101
-            )
102
-        ));
94
+	public function deleteAvoidanceZone($territory_id)
95
+	{
96
+		$result = Route4Me::makeRequst(array(
97
+			'url'    => Endpoint::AVOIDANCE_ZONE,
98
+			'method' => 'DELETEARRAY',
99
+			'query'  => array(
100
+				'territory_id' => $territory_id
101
+			)
102
+		));
103 103
 
104
-        return $result;
105
-    }
104
+		return $result;
105
+	}
106 106
     
107
-    public function updateAvoidanceZone($params)
108
-    {
109
-        $avoidanceZone = Route4Me::makeRequst(array(
110
-            'url'    => Endpoint::AVOIDANCE_ZONE,
111
-            'method' => 'PUT',
112
-            'body'   => $params,
113
-        ));
107
+	public function updateAvoidanceZone($params)
108
+	{
109
+		$avoidanceZone = Route4Me::makeRequst(array(
110
+			'url'    => Endpoint::AVOIDANCE_ZONE,
111
+			'method' => 'PUT',
112
+			'body'   => $params,
113
+		));
114 114
 
115
-        return $avoidanceZone;
116
-    }
115
+		return $avoidanceZone;
116
+	}
117 117
 }
Please login to merge, or discard this patch.
examples/optimizationWithCallbackUrl.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
 $addresses = array();
30 30
 
31 31
 foreach ($json as $address) {
32
-    $addresses[] = Address::fromArray($address);
32
+	$addresses[] = Address::fromArray($address);
33 33
 }
34 34
 
35 35
 $parameters = RouteParameters::fromArray(array(
36
-    "algorithm_type"          => AlgorithmType::TSP,
37
-    "distance_unit"           => DistanceUnit::MILES,
38
-    "device_type"             => DeviceType::WEB,
39
-    "optimize"                => OptimizationType::DISTANCE,
40
-    "travel_mode"             => TravelMode::DRIVING,
41
-    "route_max_duration"      => 86400,
42
-    "vehicle_capacity"        => 1,
43
-    "vehicle_max_distance_mi" => 10000,
44
-    "rt"                      => true,
45
-    "optimized_callback_url"  => "https://requestb.in/1o6cgge1"
36
+	"algorithm_type"          => AlgorithmType::TSP,
37
+	"distance_unit"           => DistanceUnit::MILES,
38
+	"device_type"             => DeviceType::WEB,
39
+	"optimize"                => OptimizationType::DISTANCE,
40
+	"travel_mode"             => TravelMode::DRIVING,
41
+	"route_max_duration"      => 86400,
42
+	"vehicle_capacity"        => 1,
43
+	"vehicle_max_distance_mi" => 10000,
44
+	"rt"                      => true,
45
+	"optimized_callback_url"  => "https://requestb.in/1o6cgge1"
46 46
 ));
47 47
 
48 48
 $optimizationParams = new OptimizationProblemParams;
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 $problems = OptimizationProblem::optimize($optimizationParams);
53 53
 
54 54
 foreach ($problems as $problem) {
55
-    if (is_array($problem) || is_object($problem)) {
56
-        foreach ($problem as $key => $value) {
57
-            if (!is_object($value)) {
58
-                echo $key." --> ".$value."<br>";
59
-            }
60
-        }
61
-    }
55
+	if (is_array($problem) || is_object($problem)) {
56
+		foreach ($problem as $key => $value) {
57
+			if (!is_object($value)) {
58
+				echo $key." --> ".$value."<br>";
59
+			}
60
+		}
61
+	}
62 62
 }
Please login to merge, or discard this patch.
examples/Routes/GetRoutePathPoints.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -23,25 +23,25 @@
 block discarded – undo
23 23
 
24 24
 // Get a route with the path points
25 25
 $params = array(
26
-    "route_path_output" => "Points",
27
-    "route_id"          => $route_id
26
+	"route_path_output" => "Points",
27
+	"route_id"          => $route_id
28 28
 );
29 29
 
30 30
 $routeResults = (array)$route->getRoutePoints($params);
31 31
 
32 32
 if (isset($routeResults['addresses'])) {
33
-    foreach ($routeResults['addresses'] as $key => $address) {
34
-        $araddress = (array)$address;
33
+	foreach ($routeResults['addresses'] as $key => $address) {
34
+		$araddress = (array)$address;
35 35
 
36
-        if (isset($araddress['route_destination_id'])) {
37
-            echo "route_destination_id=".$araddress['route_destination_id']."<br>";
38
-        }
36
+		if (isset($araddress['route_destination_id'])) {
37
+			echo "route_destination_id=".$araddress['route_destination_id']."<br>";
38
+		}
39 39
 
40
-        if (isset($araddress['path_to_next'])) {
41
-            echo "path_to_next:<br>";
42
-            Route4Me::simplePrint($araddress['path_to_next']);
43
-        }
40
+		if (isset($araddress['path_to_next'])) {
41
+			echo "path_to_next:<br>";
42
+			Route4Me::simplePrint($araddress['path_to_next']);
43
+		}
44 44
 
45
-        echo "<br>";
46
-    }
45
+		echo "<br>";
46
+	}
47 47
 }
Please login to merge, or discard this patch.
src/Route4Me/Exception/myErrorHandler.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@
 block discarded – undo
3 3
 
4 4
 class myErrorHandler extends \Exception
5 5
 {
6
-    public function proc_error($errno, $errstr, $errfile, $errline) 
7
-    {
8
-        echo "Error No: $errno,  line: $errline --- ".$errstr."<br>";
6
+	public function proc_error($errno, $errstr, $errfile, $errline) 
7
+	{
8
+		echo "Error No: $errno,  line: $errline --- ".$errstr."<br>";
9 9
     
10
-    }
10
+	}
11 11
 }
Please login to merge, or discard this patch.
src/Route4Me/Route4Me.php 1 patch
Indentation   +246 added lines, -246 removed lines patch added patch discarded remove patch
@@ -7,287 +7,287 @@
 block discarded – undo
7 7
 
8 8
 class Route4Me
9 9
 {
10
-    static public $apiKey;
11
-    static public $baseUrl = Endpoint::BASE_URL;
10
+	static public $apiKey;
11
+	static public $baseUrl = Endpoint::BASE_URL;
12 12
 
13
-    public static function setApiKey($apiKey)
14
-    {
15
-        self::$apiKey = $apiKey;
16
-    }
13
+	public static function setApiKey($apiKey)
14
+	{
15
+		self::$apiKey = $apiKey;
16
+	}
17 17
 
18
-    public static function getApiKey()
19
-    {
20
-        return self::$apiKey;
21
-    }
18
+	public static function getApiKey()
19
+	{
20
+		return self::$apiKey;
21
+	}
22 22
 
23
-    public static function setBaseUrl($baseUrl)
24
-    {
25
-        self::$baseUrl = $baseUrl;
26
-    }
23
+	public static function setBaseUrl($baseUrl)
24
+	{
25
+		self::$baseUrl = $baseUrl;
26
+	}
27 27
 
28
-    public static function getBaseUrl()
29
-    {
30
-        return self::$baseUrl;
31
-    }
28
+	public static function getBaseUrl()
29
+	{
30
+		return self::$baseUrl;
31
+	}
32 32
     
33
-    public static function makeRequst($options) {
34
-        $method = isset($options['method']) ? $options['method'] : 'GET';
35
-        $query = isset($options['query']) ? array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
33
+	public static function makeRequst($options) {
34
+		$method = isset($options['method']) ? $options['method'] : 'GET';
35
+		$query = isset($options['query']) ? array_filter($options['query'], function($x) { return !is_null($x); } ) : array();
36 36
 
37
-        $body = isset($options['body']) ? $options['body'] : null;
38
-        $file = isset($options['FILE']) ? $options['FILE'] : null;
39
-        $headers = array(
40
-            "User-Agent: Route4Me php-sdk"
41
-        );
37
+		$body = isset($options['body']) ? $options['body'] : null;
38
+		$file = isset($options['FILE']) ? $options['FILE'] : null;
39
+		$headers = array(
40
+			"User-Agent: Route4Me php-sdk"
41
+		);
42 42
 
43
-        if (isset($options['HTTPHEADER'])) {
44
-            $headers[] = $options['HTTPHEADER'];
45
-        }
43
+		if (isset($options['HTTPHEADER'])) {
44
+			$headers[] = $options['HTTPHEADER'];
45
+		}
46 46
 
47
-        if (isset($options['HTTPHEADERS'])) {
48
-            foreach ($options['HTTPHEADERS'] As $header) {
49
-                $headers[] = $header;
50
-            } 
51
-        }
47
+		if (isset($options['HTTPHEADERS'])) {
48
+			foreach ($options['HTTPHEADERS'] As $header) {
49
+				$headers[] = $header;
50
+			} 
51
+		}
52 52
 
53
-        $ch = curl_init();
53
+		$ch = curl_init();
54 54
 
55
-        $url = isset($options['url']) ? $options['url'].'?'.http_build_query(array_merge(
56
-            $query, array('api_key' => self::getApiKey())
57
-        )) : "";
55
+		$url = isset($options['url']) ? $options['url'].'?'.http_build_query(array_merge(
56
+			$query, array('api_key' => self::getApiKey())
57
+		)) : "";
58 58
 
59
-        $baseUrl = self::getBaseUrl();
59
+		$baseUrl = self::getBaseUrl();
60 60
  
61
-        $curlOpts = array(
62
-            CURLOPT_URL            => $baseUrl.$url,
63
-            CURLOPT_RETURNTRANSFER => true,
64
-            CURLOPT_TIMEOUT        => 80,
65
-            CURLOPT_FOLLOWLOCATION => true,
66
-            CURLOPT_SSL_VERIFYHOST => FALSE,
67
-            CURLOPT_SSL_VERIFYPEER => FALSE,
68
-            CURLOPT_HTTPHEADER     => $headers
69
-        );
61
+		$curlOpts = array(
62
+			CURLOPT_URL            => $baseUrl.$url,
63
+			CURLOPT_RETURNTRANSFER => true,
64
+			CURLOPT_TIMEOUT        => 80,
65
+			CURLOPT_FOLLOWLOCATION => true,
66
+			CURLOPT_SSL_VERIFYHOST => FALSE,
67
+			CURLOPT_SSL_VERIFYPEER => FALSE,
68
+			CURLOPT_HTTPHEADER     => $headers
69
+		);
70 70
         
71
-        curl_setopt_array($ch, $curlOpts);
71
+		curl_setopt_array($ch, $curlOpts);
72 72
         
73
-        if ($file!=null) {
74
-            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
75
-            $fp = fopen($file, 'r');
76
-            curl_setopt($ch, CURLOPT_INFILE, $fp);
77
-            curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
78
-        }
73
+		if ($file!=null) {
74
+			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
75
+			$fp = fopen($file, 'r');
76
+			curl_setopt($ch, CURLOPT_INFILE, $fp);
77
+			curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file));
78
+		}
79 79
 
80
-        switch ($method) {
81
-        case 'DELETE':
82
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
83
-            break;
84
-        case 'DELETEARRAY':
85
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
86
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
87
-            break;
88
-        case 'PUT':
89
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
90
-            break;
91
-        case 'POST':
92
-           if (isset($body)) {
93
-                $bodyData = json_encode($body);
94
-               if (isset($options['HTTPHEADER'])) {
95
-                  if (strpos($options['HTTPHEADER'], "multipart/form-data")>0) {
96
-                      $bodyData = $body;
97
-                  }
98
-               }
80
+		switch ($method) {
81
+		case 'DELETE':
82
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
83
+			break;
84
+		case 'DELETEARRAY':
85
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); 
86
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query));
87
+			break;
88
+		case 'PUT':
89
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
90
+			break;
91
+		case 'POST':
92
+		   if (isset($body)) {
93
+				$bodyData = json_encode($body);
94
+			   if (isset($options['HTTPHEADER'])) {
95
+				  if (strpos($options['HTTPHEADER'], "multipart/form-data")>0) {
96
+					  $bodyData = $body;
97
+				  }
98
+			   }
99 99
                
100
-               curl_setopt($ch, CURLOPT_POSTFIELDS, $bodyData); 
101
-            } 
102
-            break;
103
-        case 'ADD':
104
-            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
105
-        }
100
+			   curl_setopt($ch, CURLOPT_POSTFIELDS, $bodyData); 
101
+			} 
102
+			break;
103
+		case 'ADD':
104
+			curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break;
105
+		}
106 106
 
107
-        if (is_numeric(array_search($method, array('DELETE', 'PUT')))) {
108
-            if (isset($body)) {
109
-                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
110
-            } 
111
-        }
107
+		if (is_numeric(array_search($method, array('DELETE', 'PUT')))) {
108
+			if (isset($body)) {
109
+				curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); 
110
+			} 
111
+		}
112 112
 
113
-        $result = curl_exec($ch);
113
+		$result = curl_exec($ch);
114 114
 
115
-        $isxml = FALSE;
116
-        $jxml = "";
117
-        if (strpos($result, '<?xml')>-1) {
118
-            $xml = simplexml_load_string($result);
119
-            //$jxml = json_encode($xml);
120
-            $jxml = self::object2array($xml);
121
-            $isxml = TRUE;
122
-        }
115
+		$isxml = FALSE;
116
+		$jxml = "";
117
+		if (strpos($result, '<?xml')>-1) {
118
+			$xml = simplexml_load_string($result);
119
+			//$jxml = json_encode($xml);
120
+			$jxml = self::object2array($xml);
121
+			$isxml = TRUE;
122
+		}
123 123
         
124
-        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
125
-        curl_close($ch);
124
+		$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
125
+		curl_close($ch);
126 126
         
127
-        if (200==$code) {
128
-            if ($isxml) {
129
-                $json = $jxml;
130
-            } else {
131
-                $json = json_decode($result, true);
132
-            }
127
+		if (200==$code) {
128
+			if ($isxml) {
129
+				$json = $jxml;
130
+			} else {
131
+				$json = json_decode($result, true);
132
+			}
133 133
             
134
-            if (isset($json['errors'])) {
135
-                throw new ApiError(implode(', ', $json['errors']));
136
-            } else {
137
-                return $json;
138
-            }
139
-        } elseif (409==$code) {
140
-            throw new ApiError('Wrong API key');
141
-        } else {
142
-            throw new ApiError('Something wrong');
143
-        }
144
-    }
134
+			if (isset($json['errors'])) {
135
+				throw new ApiError(implode(', ', $json['errors']));
136
+			} else {
137
+				return $json;
138
+			}
139
+		} elseif (409==$code) {
140
+			throw new ApiError('Wrong API key');
141
+		} else {
142
+			throw new ApiError('Something wrong');
143
+		}
144
+	}
145 145
 
146
-    /**
147
-     * @param $object: JSON object
148
-     */
149
-    public static function object2array($object)
150
-    {
151
-        return @json_decode(@json_encode($object), 1);
152
-    }
146
+	/**
147
+	 * @param $object: JSON object
148
+	 */
149
+	public static function object2array($object)
150
+	{
151
+		return @json_decode(@json_encode($object), 1);
152
+	}
153 153
 
154 154
     
155
-    /**
156
-     * Prints on the screen main keys and values of the array 
157
-     * @param $results: object to be printed on the screen.
158
-     * @param $deepPrinting: if true, object will be printed recursively.
159
-     */
160
-    public static function simplePrint($results, $deepPrinting = null)
161
-    {
162
-        if (isset($results)) {
163
-            if (is_array($results)) {
164
-                foreach ($results as $key=>$result) {
165
-                    if (is_array($result)) {
166
-                        foreach ($result as $key1=>$result1) {
167
-                            if (is_array($result1)) {
168
-                                  if ($deepPrinting) {
169
-                                      echo "<br>$key1 ------><br>";
170
-                                      Route4Me::simplePrint($result1, true);
171
-                                      echo "------<br>";
172
-                                  } else {
173
-                                      echo $key1." --> "."Array() <br>";
174
-                                  } 
175
-                            } else {
176
-                                if (is_object($result1)) {
177
-                                    if ($deepPrinting) {
178
-                                        echo "<br>$key1 ------><br>";
179
-                                        $oarray = (array)$result1;
180
-                                        Route4Me::simplePrint($oarray, true);
181
-                                        echo "------<br>";
182
-                                    } else {
183
-                                        echo $key1." --> "."Object <br>";
184
-                                    } 
185
-                                } else {
186
-                                    if (!is_null($result1)) {
187
-                                        echo $key1." --> ".$result1."<br>"; 
188
-                                    }   
189
-                                }
190
-                            }
191
-                        }
192
-                    } else {
193
-                        if (is_object($result)) {
194
-                            if ($deepPrinting) {
195
-                                echo "<br>$key ------><br>";
196
-                                $oarray = (array)$result;
197
-                                Route4Me::simplePrint($oarray, true);
198
-                                echo "------<br>";
199
-                            } else {
200
-                                echo $key." --> "."Object <br>";
201
-                            } 
202
-                        } else {
203
-                            if (!is_null($result)) {
204
-                                echo $key." --> ".$result."<br>";
205
-                            }
206
-                        }
155
+	/**
156
+	 * Prints on the screen main keys and values of the array 
157
+	 * @param $results: object to be printed on the screen.
158
+	 * @param $deepPrinting: if true, object will be printed recursively.
159
+	 */
160
+	public static function simplePrint($results, $deepPrinting = null)
161
+	{
162
+		if (isset($results)) {
163
+			if (is_array($results)) {
164
+				foreach ($results as $key=>$result) {
165
+					if (is_array($result)) {
166
+						foreach ($result as $key1=>$result1) {
167
+							if (is_array($result1)) {
168
+								  if ($deepPrinting) {
169
+									  echo "<br>$key1 ------><br>";
170
+									  Route4Me::simplePrint($result1, true);
171
+									  echo "------<br>";
172
+								  } else {
173
+									  echo $key1." --> "."Array() <br>";
174
+								  } 
175
+							} else {
176
+								if (is_object($result1)) {
177
+									if ($deepPrinting) {
178
+										echo "<br>$key1 ------><br>";
179
+										$oarray = (array)$result1;
180
+										Route4Me::simplePrint($oarray, true);
181
+										echo "------<br>";
182
+									} else {
183
+										echo $key1." --> "."Object <br>";
184
+									} 
185
+								} else {
186
+									if (!is_null($result1)) {
187
+										echo $key1." --> ".$result1."<br>"; 
188
+									}   
189
+								}
190
+							}
191
+						}
192
+					} else {
193
+						if (is_object($result)) {
194
+							if ($deepPrinting) {
195
+								echo "<br>$key ------><br>";
196
+								$oarray = (array)$result;
197
+								Route4Me::simplePrint($oarray, true);
198
+								echo "------<br>";
199
+							} else {
200
+								echo $key." --> "."Object <br>";
201
+							} 
202
+						} else {
203
+							if (!is_null($result)) {
204
+								echo $key." --> ".$result."<br>";
205
+							}
206
+						}
207 207
                         
208
-                    }
209
-                    //echo "<br>";
210
-                }
211
-            } 
212
-        }
213
-    }
208
+					}
209
+					//echo "<br>";
210
+				}
211
+			} 
212
+		}
213
+	}
214 214
 
215
-    /**
216
-     * Generates query or body parameters.
217
-     * @param $allFields: all known fields could be used for parameters generation.
218
-     * @param $params: input parameters (array or object)
219
-     */
220
-    public static function generateRequestParameters($allFields, $params)
221
-    {
222
-        $generatedParams = array();
215
+	/**
216
+	 * Generates query or body parameters.
217
+	 * @param $allFields: all known fields could be used for parameters generation.
218
+	 * @param $params: input parameters (array or object)
219
+	 */
220
+	public static function generateRequestParameters($allFields, $params)
221
+	{
222
+		$generatedParams = array();
223 223
         
224
-        if (is_array($params)) {
225
-            foreach ($allFields as $field) {
226
-                if (isset($params[$field])) {
227
-                    $generatedParams[$field] = $params[$field];
228
-                }
229
-            }
230
-        } elseif (is_object($params)) {
231
-            foreach ($allFields as $field) {
232
-                if (isset($params->{$field})) {
233
-                    $generatedParams[$field] = $params->{$field};
234
-                }
235
-            }
236
-        }
224
+		if (is_array($params)) {
225
+			foreach ($allFields as $field) {
226
+				if (isset($params[$field])) {
227
+					$generatedParams[$field] = $params[$field];
228
+				}
229
+			}
230
+		} elseif (is_object($params)) {
231
+			foreach ($allFields as $field) {
232
+				if (isset($params->{$field})) {
233
+					$generatedParams[$field] = $params->{$field};
234
+				}
235
+			}
236
+		}
237 237
 
238
-        return $generatedParams;
239
-    }
238
+		return $generatedParams;
239
+	}
240 240
     
241
-    /**
242
-     * Returns an array of the object properties
243
-     * @param $object: An object.
244
-     * @param $exclude: array of the object parameters to be excluded from the returned array.
245
-     */
246
-    public static function getObjectProperties($object, $exclude)
247
-    {
248
-        $objectParameters = array();
241
+	/**
242
+	 * Returns an array of the object properties
243
+	 * @param $object: An object.
244
+	 * @param $exclude: array of the object parameters to be excluded from the returned array.
245
+	 */
246
+	public static function getObjectProperties($object, $exclude)
247
+	{
248
+		$objectParameters = array();
249 249
         
250
-        foreach (get_object_vars($object) as $key => $value) {
251
-            if (property_exists($object, $key)) {
252
-                if (!is_numeric(array_search($key, $exclude))) {
253
-                    array_push($objectParameters, $key);
254
-                }
255
-            }
256
-        }
250
+		foreach (get_object_vars($object) as $key => $value) {
251
+			if (property_exists($object, $key)) {
252
+				if (!is_numeric(array_search($key, $exclude))) {
253
+					array_push($objectParameters, $key);
254
+				}
255
+			}
256
+		}
257 257
         
258
-        return $objectParameters;
259
-    }
258
+		return $objectParameters;
259
+	}
260 260
     
261
-    /**
262
-     * Returns url path generated from the array of the fields and parameters.
263
-     * @param $allFields; array of the paossible fields (parameter names).
264
-     * @param $params: input parameters (array or object).
265
-     */
266
-    public static function generateUrlPath($allFields, $params)
267
-    {
268
-        $generatedPath = "";
261
+	/**
262
+	 * Returns url path generated from the array of the fields and parameters.
263
+	 * @param $allFields; array of the paossible fields (parameter names).
264
+	 * @param $params: input parameters (array or object).
265
+	 */
266
+	public static function generateUrlPath($allFields, $params)
267
+	{
268
+		$generatedPath = "";
269 269
 
270
-        if (is_array($params)) {
271
-            foreach ($allFields as $field) {
272
-                if (isset($params[$field])) {
273
-                    $generatedPath .= $params[$field].'/';
274
-                }
275
-            }
276
-        } elseif (is_object($params)) {
277
-            foreach ($allFields as $field) {
278
-                if (isset($params->{$field})) {
279
-                    $generatedPath .= $params->{$field}.'/';
280
-                }
281
-            }
282
-        }
270
+		if (is_array($params)) {
271
+			foreach ($allFields as $field) {
272
+				if (isset($params[$field])) {
273
+					$generatedPath .= $params[$field].'/';
274
+				}
275
+			}
276
+		} elseif (is_object($params)) {
277
+			foreach ($allFields as $field) {
278
+				if (isset($params->{$field})) {
279
+					$generatedPath .= $params->{$field}.'/';
280
+				}
281
+			}
282
+		}
283 283
         
284
-        return $generatedPath;
285
-    }
284
+		return $generatedPath;
285
+	}
286 286
     
287
-    public static function getFileRealPath($fileName)
288
-    {
289
-        $rpath = function_exists('curl_file_create') ? curl_file_create(realpath($fileName)) : '@'.realpath($fileName);
287
+	public static function getFileRealPath($fileName)
288
+	{
289
+		$rpath = function_exists('curl_file_create') ? curl_file_create(realpath($fileName)) : '@'.realpath($fileName);
290 290
         
291
-        return $rpath;
292
-    }
291
+		return $rpath;
292
+	}
293 293
 }
Please login to merge, or discard this patch.
examples/Activities/GetRouteActivities.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 $route = new Route();
20 20
 $route_id = $route->getRandomRouteId(0, 10);
21 21
 echo "route_id -> $route_id <br>";
22
-$count=0;
22
+$count = 0;
23 23
 
24 24
 // Itereate through all the existing activity types
25 25
 foreach ($activityTypes->getConstants() as $prop => $value) {
Please login to merge, or discard this patch.
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -23,26 +23,26 @@
 block discarded – undo
23 23
 
24 24
 // Itereate through all the existing activity types
25 25
 foreach ($activityTypes->getConstants() as $prop => $value) {
26
-    $activityParameters = ActivityParameters::fromArray(array(
27
-        "activity_type" => $value,
28
-        "limit"         => 2,
29
-        "offset"        => 0,
30
-        "route_id"      => $route_id
31
-    ));
26
+	$activityParameters = ActivityParameters::fromArray(array(
27
+		"activity_type" => $value,
28
+		"limit"         => 2,
29
+		"offset"        => 0,
30
+		"route_id"      => $route_id
31
+	));
32 32
     
33
-    $activities = new ActivityParameters();
34
-    $results = $activities->searchActivities($activityParameters);
33
+	$activities = new ActivityParameters();
34
+	$results = $activities->searchActivities($activityParameters);
35 35
     
36
-    if (!is_array($results) || !is_array($results['results']) || sizeof($results['results'])<1) {
37
-        continue;
38
-    }
36
+	if (!is_array($results) || !is_array($results['results']) || sizeof($results['results'])<1) {
37
+		continue;
38
+	}
39 39
     
40
-    $count++;
40
+	$count++;
41 41
 	
42
-    foreach ($results as $key => $activity) {
43
-        Route4Me::simplePrint($activity);
44
-        echo "<br>";
45
-    }
42
+	foreach ($results as $key => $activity) {
43
+		Route4Me::simplePrint($activity);
44
+		echo "<br>";
45
+	}
46 46
     
47
-    echo "------------------- <br><br>";
47
+	echo "------------------- <br><br>";
48 48
 }
Please login to merge, or discard this patch.
examples/AddressBook/AddAddressBookLocation.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 block discarded – undo
11 11
 Route4Me::setApiKey('11111111111111111111111111111111');
12 12
 
13 13
 $AddressBookLocationParameters = AddressBookLocation::fromArray(array(
14
-    "first_name"  => "Test FirstName ".strval(rand(10000, 99999)),
15
-    "address_1"   => "Test Address1 ".strval(rand(10000, 99999)),
16
-    "cached_lat"  => 38.024654,
17
-    "cached_lng"  => -77.338814
14
+	"first_name"  => "Test FirstName ".strval(rand(10000, 99999)),
15
+	"address_1"   => "Test Address1 ".strval(rand(10000, 99999)),
16
+	"cached_lat"  => 38.024654,
17
+	"cached_lng"  => -77.338814
18 18
 ));
19 19
 
20 20
 $abContacts = new AddressBookLocation();
Please login to merge, or discard this patch.
examples/AddressBook/AddScheduledAddressBookLocation.php 1 patch
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -12,24 +12,24 @@  discard block
 block discarded – undo
12 12
 
13 13
 #region // Add a location, scheduled daily with custom data.
14 14
 $AddressBookLocationParameters = AddressBookLocation::fromArray(array(
15
-    "address_1"            => "1604 PARKRIDGE PKWY, Louisville, KY, 40214",
16
-    "address_alias"        => "1604 PARKRIDGE PKWY 40214",
17
-    "address_group"        => "Scheduled daily",
18
-    "first_name"           => "Peter",
19
-    "last_name"            => "Newman",
20
-    "address_email"        => "[email protected]",
21
-    "address_phone_number" => "65432178",
22
-    "cached_lat"           => 38.141598,
23
-    "cached_lng"           => -85.793846,
24
-    "address_city"         => "Louisville",
25
-    "address_custom_data"  => array("scheduled"   => "yes", 
26
-                                    "serice type" => "publishing"),
27
-    "schedule" => array(array(
28
-        "enabled" => true,
29
-        "mode"    => "daily",
30
-        "daily"   => array("every" => 1)
31
-    )),
32
-    "service_time" => 900
15
+	"address_1"            => "1604 PARKRIDGE PKWY, Louisville, KY, 40214",
16
+	"address_alias"        => "1604 PARKRIDGE PKWY 40214",
17
+	"address_group"        => "Scheduled daily",
18
+	"first_name"           => "Peter",
19
+	"last_name"            => "Newman",
20
+	"address_email"        => "[email protected]",
21
+	"address_phone_number" => "65432178",
22
+	"cached_lat"           => 38.141598,
23
+	"cached_lng"           => -85.793846,
24
+	"address_city"         => "Louisville",
25
+	"address_custom_data"  => array("scheduled"   => "yes", 
26
+									"serice type" => "publishing"),
27
+	"schedule" => array(array(
28
+		"enabled" => true,
29
+		"mode"    => "daily",
30
+		"daily"   => array("every" => 1)
31
+	)),
32
+	"service_time" => 900
33 33
 ));
34 34
 
35 35
 $abContacts1 = new AddressBookLocation();
@@ -44,27 +44,27 @@  discard block
 block discarded – undo
44 44
 
45 45
 #region // Add a location, scheduled weekly.
46 46
 $AddressBookLocationParameters = AddressBookLocation::fromArray(array(
47
-    "address_1"            => "1407 MCCOY, Louisville, KY, 40215",
48
-    "address_alias"        => "1407 MCCOY 40215",
49
-    "address_group"        => "Scheduled weekly",
50
-    "first_name"           => "Bart",
51
-    "last_name"            => "Douglas",
52
-    "address_email"        => "[email protected]",
53
-    "address_phone_number" => "95487454",
54
-    "cached_lat"           => 38.202496,
55
-    "cached_lng"           => -85.786514,
56
-    "curbside_lat"         => 38.202496,
57
-    "curbside_lng"         => -85.786514,
58
-    "address_city"         => "Louisville",
59
-    "schedule" => array(array(
60
-        "enabled" => true,
61
-        "mode"    => "weekly",
62
-        "weekly"  => array(
63
-            "every"    => 1,
64
-            "weekdays" => array(1, 2, 3, 4, 5)
65
-        )
66
-    )),
67
-    "service_time" => 600
47
+	"address_1"            => "1407 MCCOY, Louisville, KY, 40215",
48
+	"address_alias"        => "1407 MCCOY 40215",
49
+	"address_group"        => "Scheduled weekly",
50
+	"first_name"           => "Bart",
51
+	"last_name"            => "Douglas",
52
+	"address_email"        => "[email protected]",
53
+	"address_phone_number" => "95487454",
54
+	"cached_lat"           => 38.202496,
55
+	"cached_lng"           => -85.786514,
56
+	"curbside_lat"         => 38.202496,
57
+	"curbside_lng"         => -85.786514,
58
+	"address_city"         => "Louisville",
59
+	"schedule" => array(array(
60
+		"enabled" => true,
61
+		"mode"    => "weekly",
62
+		"weekly"  => array(
63
+			"every"    => 1,
64
+			"weekdays" => array(1, 2, 3, 4, 5)
65
+		)
66
+	)),
67
+	"service_time" => 600
68 68
 ));
69 69
 
70 70
 $abContacts2 = new AddressBookLocation();
@@ -79,33 +79,33 @@  discard block
 block discarded – undo
79 79
 
80 80
 #region // Add a location, scheduled monthly (dates mode).
81 81
 $AddressBookLocationParameters = AddressBookLocation::fromArray(array(
82
-    "address_1"            => "4805 BELLEVUE AVE, Louisville, KY, 40215",
83
-    "address_2"            => "4806 BELLEVUE AVE, Louisville, KY, 40215",
84
-    "address_alias"        => "4805 BELLEVUE AVE 40215",
85
-    "address_group"        => "Scheduled monthly",
86
-    "first_name"           => "Bart",
87
-    "last_name"            => "Douglas",
88
-    "address_email"        => "[email protected]",
89
-    "address_phone_number" => "95487454",
90
-    "cached_lat"           => 38.178844,
91
-    "cached_lng"           => -85.774864,
92
-    "curbside_lat"         => 38.178844,
93
-    "curbside_lng"         => -85.774864,
94
-    "address_city"         => "Louisville",
95
-    "address_country_id"   => "US",
96
-    "address_state_id"     => "KY",
97
-    "address_zip"          => "40215",
98
-    "schedule" => array(array(
99
-        "enabled" => true,
100
-        "mode"    => "monthly",
101
-        "monthly" => array(
102
-            "every" => 1,
103
-            "mode"  => "dates",
104
-            "dates" => array(20, 22, 23, 24, 25)
105
-        )
106
-    )),
107
-    "service_time" => 750,
108
-    "color" => "red"
82
+	"address_1"            => "4805 BELLEVUE AVE, Louisville, KY, 40215",
83
+	"address_2"            => "4806 BELLEVUE AVE, Louisville, KY, 40215",
84
+	"address_alias"        => "4805 BELLEVUE AVE 40215",
85
+	"address_group"        => "Scheduled monthly",
86
+	"first_name"           => "Bart",
87
+	"last_name"            => "Douglas",
88
+	"address_email"        => "[email protected]",
89
+	"address_phone_number" => "95487454",
90
+	"cached_lat"           => 38.178844,
91
+	"cached_lng"           => -85.774864,
92
+	"curbside_lat"         => 38.178844,
93
+	"curbside_lng"         => -85.774864,
94
+	"address_city"         => "Louisville",
95
+	"address_country_id"   => "US",
96
+	"address_state_id"     => "KY",
97
+	"address_zip"          => "40215",
98
+	"schedule" => array(array(
99
+		"enabled" => true,
100
+		"mode"    => "monthly",
101
+		"monthly" => array(
102
+			"every" => 1,
103
+			"mode"  => "dates",
104
+			"dates" => array(20, 22, 23, 24, 25)
105
+		)
106
+	)),
107
+	"service_time" => 750,
108
+	"color" => "red"
109 109
 ));
110 110
 
111 111
 $abContacts3 = new AddressBookLocation();
@@ -120,36 +120,36 @@  discard block
 block discarded – undo
120 120
 
121 121
 #region // AAdd a location, scheduled monthly (nth mode).
122 122
 $AddressBookLocationParameters = AddressBookLocation::fromArray(array(
123
-    "address_1"            => "730 CECIL AVENUE, Louisville, KY, 40211",
124
-    "address_alias"        => "730 CECIL AVENUE 40211",
125
-    "address_group"        => "Scheduled monthly",
126
-    "first_name"           => "David",
127
-    "last_name"            => "Silvester",
128
-    "address_email"        => "[email protected]",
129
-    "address_phone_number" => "36985214",
130
-    "cached_lat"           => 38.248684,
131
-    "cached_lng"           => -85.821121,
132
-    "curbside_lat"         => 38.248684,
133
-    "curbside_lng"         => -85.821121,
134
-    "address_city"         => "Louisville",
135
-    "address_custom_data" => array(
136
-        "scheduled"    => "yes",
137
-        "service type" => "library"
138
-    ),
139
-    "schedule" => array(array(
140
-        "enabled" => true,
141
-        "mode"    => "monthly",
142
-        "monthly" => array(
143
-            "every" => 1,
144
-            "mode"  => "nth",
145
-            "nth"   => array(
146
-                "n"    => 1,
147
-                "what" => 4
148
-            )
149
-        )
150
-    )),
151
-    "service_time" => 450,
152
-    "address_icon" => "emoji/emoji-bus"
123
+	"address_1"            => "730 CECIL AVENUE, Louisville, KY, 40211",
124
+	"address_alias"        => "730 CECIL AVENUE 40211",
125
+	"address_group"        => "Scheduled monthly",
126
+	"first_name"           => "David",
127
+	"last_name"            => "Silvester",
128
+	"address_email"        => "[email protected]",
129
+	"address_phone_number" => "36985214",
130
+	"cached_lat"           => 38.248684,
131
+	"cached_lng"           => -85.821121,
132
+	"curbside_lat"         => 38.248684,
133
+	"curbside_lng"         => -85.821121,
134
+	"address_city"         => "Louisville",
135
+	"address_custom_data" => array(
136
+		"scheduled"    => "yes",
137
+		"service type" => "library"
138
+	),
139
+	"schedule" => array(array(
140
+		"enabled" => true,
141
+		"mode"    => "monthly",
142
+		"monthly" => array(
143
+			"every" => 1,
144
+			"mode"  => "nth",
145
+			"nth"   => array(
146
+				"n"    => 1,
147
+				"what" => 4
148
+			)
149
+		)
150
+	)),
151
+	"service_time" => 450,
152
+	"address_icon" => "emoji/emoji-bus"
153 153
 ));
154 154
 
155 155
 $abContacts4 = new AddressBookLocation();
@@ -164,29 +164,29 @@  discard block
 block discarded – undo
164 164
 
165 165
 #region // Add a location with the daily scheduling and blacklist.
166 166
 $AddressBookLocationParameters = AddressBookLocation::fromArray(array(
167
-    "address_1"            => "4629 HILLSIDE DRIVE, Louisville, KY, 40216",
168
-    "address_alias"        => "4629 HILLSIDE DRIVE 40216",
169
-    "address_group"        => "Scheduled daily",
170
-    "first_name"           => "Kim",
171
-    "last_name"            => "Shandor",
172
-    "address_email"        => "[email protected]",
173
-    "address_phone_number" => "9874152",
174
-    "cached_lat"           => 38.176067,
175
-    "cached_lng"           => -85.824638,
176
-    "curbside_lat"         => 38.176067,
177
-    "curbside_lng"         => -85.824638,
178
-    "address_city"         => "Louisville",
179
-    "address_custom_data"  => array(
180
-        "scheduled"   => "yes",
181
-        "serice type" => "appliance"
182
-    ),
183
-    "schedule" => array(
184
-        "enabled" => true,
185
-        "mode"    => "daily",
186
-        "daily"   => array("every" => 1)
187
-    ),
188
-    "schedule_blacklist" => array("2017-02-24", "2017-02-25"),
189
-    "service_time"       => 300
167
+	"address_1"            => "4629 HILLSIDE DRIVE, Louisville, KY, 40216",
168
+	"address_alias"        => "4629 HILLSIDE DRIVE 40216",
169
+	"address_group"        => "Scheduled daily",
170
+	"first_name"           => "Kim",
171
+	"last_name"            => "Shandor",
172
+	"address_email"        => "[email protected]",
173
+	"address_phone_number" => "9874152",
174
+	"cached_lat"           => 38.176067,
175
+	"cached_lng"           => -85.824638,
176
+	"curbside_lat"         => 38.176067,
177
+	"curbside_lng"         => -85.824638,
178
+	"address_city"         => "Louisville",
179
+	"address_custom_data"  => array(
180
+		"scheduled"   => "yes",
181
+		"serice type" => "appliance"
182
+	),
183
+	"schedule" => array(
184
+		"enabled" => true,
185
+		"mode"    => "daily",
186
+		"daily"   => array("every" => 1)
187
+	),
188
+	"schedule_blacklist" => array("2017-02-24", "2017-02-25"),
189
+	"service_time"       => 300
190 190
 ));
191 191
 
192 192
 $abContacts5 = new AddressBookLocation();
Please login to merge, or discard this patch.
examples/AddressBook/GetAddressBookLocationsByIDs.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
 // Get two random locations IDs
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();
@@ -38,6 +38,6 @@  discard block
 block discarded – undo
38 38
 $results = $ablocation->getValue($abcResult, "results");
39 39
 
40 40
 foreach ($results as $result) {
41
-    Route4Me::simplePrint($result);
42
-    echo "<br>";
41
+	Route4Me::simplePrint($result);
42
+	echo "<br>";
43 43
 }
Please login to merge, or discard this patch.