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 ( c91163...0a9ac4 )
by Oleg
03:12 queued 44s
created
src/Route4Me/OptimizationProblemParams.php 1 patch
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -7,93 +7,93 @@
 block discarded – undo
7 7
 
8 8
 class OptimizationProblemParams extends Common
9 9
 {
10
-    public $optimization_problem_id;
11
-    public $reoptimize;
12
-    public $addresses = array();
13
-    public $parameters;
14
-    public $directions;
15
-    public $format;
16
-    public $route_path_output;
17
-    public $optimized_callback_url;
18
-    public $redirect = true;
10
+	public $optimization_problem_id;
11
+	public $reoptimize;
12
+	public $addresses = array();
13
+	public $parameters;
14
+	public $directions;
15
+	public $format;
16
+	public $route_path_output;
17
+	public $optimized_callback_url;
18
+	public $redirect = true;
19 19
 
20
-    public static function fromArray($params)
21
-    {
22
-        $param = new OptimizationProblemParams;
23
-        if (!isset($params['addresses'])) {
24
-            throw new BadParam('addresses must be provided.');
25
-        }
20
+	public static function fromArray($params)
21
+	{
22
+		$param = new OptimizationProblemParams;
23
+		if (!isset($params['addresses'])) {
24
+			throw new BadParam('addresses must be provided.');
25
+		}
26 26
 
27
-        if (!isset($params['parameters'])) {
28
-            throw new BadParam('parameters must be provided.');
29
-        }
27
+		if (!isset($params['parameters'])) {
28
+			throw new BadParam('parameters must be provided.');
29
+		}
30 30
 
31
-        if ($params['parameters'] instanceof RouteParameters) {
32
-            $param->setParameters($params['parameters']);
33
-        } else {
34
-            $param->setParameters(RouteParameters::fromArray($params['parameters']));
35
-        }
31
+		if ($params['parameters'] instanceof RouteParameters) {
32
+			$param->setParameters($params['parameters']);
33
+		} else {
34
+			$param->setParameters(RouteParameters::fromArray($params['parameters']));
35
+		}
36 36
 
37
-        foreach ($params['addresses'] as $address) {
38
-            if (!($address instanceof Address)) {
39
-                $address = Address::fromArray($address);
40
-            }
37
+		foreach ($params['addresses'] as $address) {
38
+			if (!($address instanceof Address)) {
39
+				$address = Address::fromArray($address);
40
+			}
41 41
             
42
-            $param->addAddress($address);
43
-        }
42
+			$param->addAddress($address);
43
+		}
44 44
 
45
-        $param->directions = self::getValue($params, 'directions');
46
-        $param->format = self::getValue($params, 'format');
47
-        $param->route_path_output = self::getValue($params, 'route_path_output');
48
-        $param->optimized_callback_url = self::getValue($params, 'optimized_callback_url');
49
-        $param->optimization_problem_id = self::getValue($params, 'optimization_problem_id');
50
-        $param->reoptimize = self::getValue($params, 'reoptimize');
51
-        $param->redirect = filter_var(self::getValue($params, 'redirect', true), FILTER_VALIDATE_BOOLEAN);
45
+		$param->directions = self::getValue($params, 'directions');
46
+		$param->format = self::getValue($params, 'format');
47
+		$param->route_path_output = self::getValue($params, 'route_path_output');
48
+		$param->optimized_callback_url = self::getValue($params, 'optimized_callback_url');
49
+		$param->optimization_problem_id = self::getValue($params, 'optimization_problem_id');
50
+		$param->reoptimize = self::getValue($params, 'reoptimize');
51
+		$param->redirect = filter_var(self::getValue($params, 'redirect', true), FILTER_VALIDATE_BOOLEAN);
52 52
 
53
-        return $param;
54
-    }
53
+		return $param;
54
+	}
55 55
 
56
-    public function __construct()
57
-    {
58
-        $this->parameters = new RouteParameters;
59
-    }
56
+	public function __construct()
57
+	{
58
+		$this->parameters = new RouteParameters;
59
+	}
60 60
 
61
-    public function setParameters(RouteParameters $params)
62
-    {
63
-        $this->parameters = $params;
61
+	public function setParameters(RouteParameters $params)
62
+	{
63
+		$this->parameters = $params;
64 64
         
65
-        return $this;
66
-    }
65
+		return $this;
66
+	}
67 67
 
68
-    public function addAddress(Address $address)
69
-    {
70
-        $this->addresses[] = $address;
68
+	public function addAddress(Address $address)
69
+	{
70
+		$this->addresses[] = $address;
71 71
         
72
-        return $this;
73
-    }
72
+		return $this;
73
+	}
74 74
     
75
-    public function getAddressesArray()
76
-    {
77
-        $addresses = array();
75
+	public function getAddressesArray()
76
+	{
77
+		$addresses = array();
78 78
         
79
-        foreach ($this->addresses as $address) {
80
-            $addresses[] = $address->toArray();
81
-        }
79
+		foreach ($this->addresses as $address) {
80
+			$addresses[] = $address->toArray();
81
+		}
82 82
         
83
-        return $addresses;
84
-    }
83
+		return $addresses;
84
+	}
85 85
 
86
-    public function getParametersArray()
87
-    {
88
-        return $this->parameters->toArray();
89
-    }
86
+	public function getParametersArray()
87
+	{
88
+		return $this->parameters->toArray();
89
+	}
90 90
 
91
-    public function setAddresses(array $addresses)
92
-    {
93
-        foreach ($addresses as $address) {
94
-            $this->addAddress($address);
95
-        }
91
+	public function setAddresses(array $addresses)
92
+	{
93
+		foreach ($addresses as $address) {
94
+			$this->addAddress($address);
95
+		}
96 96
         
97
-        return $this;
98
-    }
97
+		return $this;
98
+	}
99 99
 }
Please login to merge, or discard this patch.
src/Route4Me/Enum/AlgorithmType.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@
 block discarded – undo
3 3
 
4 4
 class AlgorithmType
5 5
 {
6
-    const TSP = 1;
7
-    const VRP = 2;
8
-    const CVRP_TW_SD = 3;
9
-    const CVRP_TW_MD = 4;
10
-    const TSP_TW = 5;
11
-    const TSP_TW_CR = 6;
12
-    const BBCVRP = 7;
13
-    const ALG_NONE = 100;
14
-    const ALG_LEGACY_DISTRIBUTED = 101;
6
+	const TSP = 1;
7
+	const VRP = 2;
8
+	const CVRP_TW_SD = 3;
9
+	const CVRP_TW_MD = 4;
10
+	const TSP_TW = 5;
11
+	const TSP_TW_CR = 6;
12
+	const BBCVRP = 7;
13
+	const ALG_NONE = 100;
14
+	const ALG_LEGACY_DISTRIBUTED = 101;
15 15
 }
Please login to merge, or discard this patch.
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
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->searcActivities($activityParameters);
33
+	$activities = new ActivityParameters();
34
+	$results = $activities->searcActivities($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.
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.
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.