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
Pull Request — master (#2)
by
unknown
07:12
created
src/Route4Me/AvoidanceZone.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -20,93 +20,93 @@
 block discarded – undo
20 20
 		
21 21
 		public static function fromArray(array $params) {
22 22
 			if (!isset($params['territory_name'])) {
23
-	            throw new BadParam('Territory name must be provided');
24
-	        }
23
+				throw new BadParam('Territory name must be provided');
24
+			}
25 25
 			
26 26
 			if (!isset($params['territory_color'])) {
27
-	            throw new BadParam('Territory color must be provided');
28
-	        }
27
+				throw new BadParam('Territory color must be provided');
28
+			}
29 29
 			
30 30
 			if (!isset($params['territory'])) {
31
-	            throw new BadParam('Territory must be provided');
32
-	        }
31
+				throw new BadParam('Territory must be provided');
32
+			}
33 33
 			
34 34
 			$avoidancezoneparameters = new AvoidanceZone();
35
-	        foreach($params as $key => $value) {
36
-	            if (property_exists($avoidancezoneparameters, $key)) {
37
-	                $avoidancezoneparameters->{$key} = $value;
38
-	            }
35
+			foreach($params as $key => $value) {
36
+				if (property_exists($avoidancezoneparameters, $key)) {
37
+					$avoidancezoneparameters->{$key} = $value;
38
+				}
39 39
 			}
40 40
 			
41 41
 			return $avoidancezoneparameters;
42 42
 		}
43 43
 		
44 44
 		public static function getAvoidanceZone($territory_id)
45
-	    {
46
-	        $avoidancezone = Route4Me::makeRequst(array(
47
-	            'url'    => self::$apiUrl,
48
-	            'method' => 'GET',
49
-	            'query'  => array(
50
-	                'territory_id'             => $territory_id
51
-	            )
52
-	        ));
45
+		{
46
+			$avoidancezone = Route4Me::makeRequst(array(
47
+				'url'    => self::$apiUrl,
48
+				'method' => 'GET',
49
+				'query'  => array(
50
+					'territory_id'             => $territory_id
51
+				)
52
+			));
53 53
 	
54
-	        return $avoidancezone;
55
-	    }
54
+			return $avoidancezone;
55
+		}
56 56
 		
57 57
 		public static function getAvoidanceZones($params)
58
-	    {
59
-	        $avoidancezones = Route4Me::makeRequst(array(
60
-	            'url'    => self::$apiUrl,
61
-	            'method' => 'GET',
62
-	            'query'  => array(
63
-	                'offset'  => isset($params->offset) ? $params->offset: null,
64
-	                'limit'   => isset($params->limit) ? $params->limit: null,
65
-	            )
66
-	        ));
58
+		{
59
+			$avoidancezones = Route4Me::makeRequst(array(
60
+				'url'    => self::$apiUrl,
61
+				'method' => 'GET',
62
+				'query'  => array(
63
+					'offset'  => isset($params->offset) ? $params->offset: null,
64
+					'limit'   => isset($params->limit) ? $params->limit: null,
65
+				)
66
+			));
67 67
 	
68
-	        return $avoidancezones;
69
-	    }
68
+			return $avoidancezones;
69
+		}
70 70
 
71 71
 		public static function addAvoidanceZone($params)
72
-	    {
73
-	    	$abcontacts = Route4Me::makeRequst(array(
74
-	            'url'    => self::$apiUrl,
75
-	            'method' => 'ADD',
76
-	            'query'  => array(
77
-	            	'territory_name' => 	isset($params->territory_name) ? $params->territory_name: null,
78
-	                'territory_color' => isset($params->territory_color) ? $params->territory_color : null,
79
-	                'territory' => isset($params->territory) ? $params->territory : null,
80
-	            )
81
-	        ));
72
+		{
73
+			$abcontacts = Route4Me::makeRequst(array(
74
+				'url'    => self::$apiUrl,
75
+				'method' => 'ADD',
76
+				'query'  => array(
77
+					'territory_name' => 	isset($params->territory_name) ? $params->territory_name: null,
78
+					'territory_color' => isset($params->territory_color) ? $params->territory_color : null,
79
+					'territory' => isset($params->territory) ? $params->territory : null,
80
+				)
81
+			));
82 82
 
83 83
 			return $abcontacts;
84 84
 		}
85 85
 		
86 86
 		public function deleteAvoidanceZone($territory_id)
87
-	    {
88
-	        $result = Route4Me::makeRequst(array(
89
-	            'url'    => self::$apiUrl,
90
-	            'method' => 'DELETEARRAY',
91
-	            'query'  => array(
92
-	                'territory_id'     => $territory_id
93
-	            )
94
-	        ));
87
+		{
88
+			$result = Route4Me::makeRequst(array(
89
+				'url'    => self::$apiUrl,
90
+				'method' => 'DELETEARRAY',
91
+				'query'  => array(
92
+					'territory_id'     => $territory_id
93
+				)
94
+			));
95 95
 	
96
-	        return $result;
97
-	    }
96
+			return $result;
97
+		}
98 98
 		
99 99
 		public function updateAvoidanceZone($params)
100
-	    {
101
-	        $avoidancezone = Route4Me::makeRequst(array(
102
-	            'url'    => self::$apiUrl,
103
-	            'method' => 'PUT',
104
-	            'query'   => (array)$params,
100
+		{
101
+			$avoidancezone = Route4Me::makeRequst(array(
102
+				'url'    => self::$apiUrl,
103
+				'method' => 'PUT',
104
+				'query'   => (array)$params,
105 105
 
106
-	        ));
106
+			));
107 107
 	
108
-	        return $avoidancezone;
109
-	    }
108
+			return $avoidancezone;
109
+		}
110 110
 	}
111 111
 	
112 112
 ?>
113 113
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
 	{
9 9
 		static public $apiUrl = '/api.v4/avoidance.php';
10 10
 	
11
-		public $territory_id;  // Avoidance zone id
11
+		public $territory_id; // Avoidance zone id
12 12
 		public $territory_name; 
13 13
 		public $territory_color;
14 14
 		public $member_id;
15 15
 		public $territory; // Territory parameters
16 16
 		
17
-		public function __construct () {
17
+		public function __construct() {
18 18
 			
19 19
 		}
20 20
 		
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	        }
33 33
 			
34 34
 			$avoidancezoneparameters = new AvoidanceZone();
35
-	        foreach($params as $key => $value) {
35
+	        foreach ($params as $key => $value) {
36 36
 	            if (property_exists($avoidancezoneparameters, $key)) {
37 37
 	                $avoidancezoneparameters->{$key} = $value;
38 38
 	            }
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	            'url'    => self::$apiUrl,
61 61
 	            'method' => 'GET',
62 62
 	            'query'  => array(
63
-	                'offset'  => isset($params->offset) ? $params->offset: null,
64
-	                'limit'   => isset($params->limit) ? $params->limit: null,
63
+	                'offset'  => isset($params->offset) ? $params->offset : null,
64
+	                'limit'   => isset($params->limit) ? $params->limit : null,
65 65
 	            )
66 66
 	        ));
67 67
 	
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	            'url'    => self::$apiUrl,
75 75
 	            'method' => 'ADD',
76 76
 	            'query'  => array(
77
-	            	'territory_name' => 	isset($params->territory_name) ? $params->territory_name: null,
77
+	            	'territory_name' => 	isset($params->territory_name) ? $params->territory_name : null,
78 78
 	                'territory_color' => isset($params->territory_color) ? $params->territory_color : null,
79 79
 	                'territory' => isset($params->territory) ? $params->territory : null,
80 80
 	            )
Please login to merge, or discard this patch.
src/Route4Me/TrackSetParams.php 1 patch
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -9,102 +9,102 @@
 block discarded – undo
9 9
 
10 10
 class TrackSetParams extends Common
11 11
 {
12
-    public $format;
13
-    public $member_id;
14
-    public $route_id;
15
-    public $tx_id;
16
-    public $vehicle_id;
17
-    public $course;
18
-    public $speed;
19
-    public $lat;
20
-    public $lng;
21
-    public $altitude;
22
-    public $device_type;
23
-    public $device_guid;
24
-    public $device_timestamp;
25
-    public $app_version;
26
-
27
-    public static function fromArray(array $params)
28
-    {
29
-        $param = new TrackSetParams;
30
-
31
-        if (!isset($params['format'])) {
32
-            throw new BadParam("format must be provided.");
33
-        }
34
-
35
-        $types = array(
36
-            Format::SERIALIZED,
37
-            Format::CSV,
38
-            Format::XML
39
-        );
40
-        if (!in_array($params['format'], $types)) {
41
-            throw new BadParam("format is invalid.");
42
-        }
43
-
44
-        if (!isset($params['route_id'])) {
45
-            throw new BadParam("route_id must be provided.");
46
-        }
47
-
48
-        if (!isset($params['member_id'])) {
49
-            throw new BadParam("member_id must be provided.");
50
-        }
51
-
52
-        if (!isset($params['course'])) {
53
-            throw new BadParam("course must be provided.");
54
-        }
55
-
56
-        if (!isset($params['speed'])) {
57
-            throw new BadParam("speed must be provided.");
58
-        }
59
-
60
-        if (!isset($params['lat'])) {
61
-            throw new BadParam("lat must be provided.");
62
-        }
63
-
64
-        if (!isset($params['lng'])) {
65
-            throw new BadParam("lng must be provided.");
66
-        }
67
-
68
-        if (!isset($params['device_type'])) {
69
-            throw new BadParam("device_type must be provided.");
70
-        }
71
-
72
-        $deviceTypes = array(
73
-            DeviceType::IPHONE,
74
-            DeviceType::IPAD,
75
-            DeviceType::ANDROID_PHONE,
76
-            DeviceType::ANDROID_TABLET
77
-        );
78
-        if (!in_array($params['device_type'], $deviceTypes)) {
79
-            throw new BadParam("device_type is invalid.");
80
-        }
81
-
82
-        if (!isset($params['device_guid'])) {
83
-            throw new BadParam("device_guid must be provided.");
84
-        }
85
-
86
-        if (isset($params['device_timestamp'])) {
87
-            $template = '/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/i';
88
-            if (!preg_match($template, $params['device_timestamp'])) {
89
-                throw new BadParam("device_timestamp is invalid.");
90
-            }
91
-        }
92
-
93
-        $param->format = self::getValue($params, 'format');
94
-        $param->route_id = self::getValue($params, 'route_id');
95
-        $param->member_id = self::getValue($params, 'member_id');
96
-        $param->course = self::getValue($params, 'course');
97
-        $param->speed = self::getValue($params, 'speed');
98
-        $param->lat = self::getValue($params, 'lat');
99
-        $param->lng = self::getValue($params, 'lng');
100
-        $param->device_type = self::getValue($params, 'device_type');
101
-        $param->device_guid = self::getValue($params, 'device_guid');
102
-        $param->device_timestamp = self::getValue($params, 'device_timestamp');
103
-        $param->vehicle_id = self::getValue($params, 'vehicle_id');
104
-        $param->altitude = self::getValue($params, 'altitude');
105
-        $param->app_version = self::getValue($params, 'app_version');
106
-        $param->tx_id = self::getValue($params, 'tx_id');
107
-
108
-        return $param;
109
-    }
12
+	public $format;
13
+	public $member_id;
14
+	public $route_id;
15
+	public $tx_id;
16
+	public $vehicle_id;
17
+	public $course;
18
+	public $speed;
19
+	public $lat;
20
+	public $lng;
21
+	public $altitude;
22
+	public $device_type;
23
+	public $device_guid;
24
+	public $device_timestamp;
25
+	public $app_version;
26
+
27
+	public static function fromArray(array $params)
28
+	{
29
+		$param = new TrackSetParams;
30
+
31
+		if (!isset($params['format'])) {
32
+			throw new BadParam("format must be provided.");
33
+		}
34
+
35
+		$types = array(
36
+			Format::SERIALIZED,
37
+			Format::CSV,
38
+			Format::XML
39
+		);
40
+		if (!in_array($params['format'], $types)) {
41
+			throw new BadParam("format is invalid.");
42
+		}
43
+
44
+		if (!isset($params['route_id'])) {
45
+			throw new BadParam("route_id must be provided.");
46
+		}
47
+
48
+		if (!isset($params['member_id'])) {
49
+			throw new BadParam("member_id must be provided.");
50
+		}
51
+
52
+		if (!isset($params['course'])) {
53
+			throw new BadParam("course must be provided.");
54
+		}
55
+
56
+		if (!isset($params['speed'])) {
57
+			throw new BadParam("speed must be provided.");
58
+		}
59
+
60
+		if (!isset($params['lat'])) {
61
+			throw new BadParam("lat must be provided.");
62
+		}
63
+
64
+		if (!isset($params['lng'])) {
65
+			throw new BadParam("lng must be provided.");
66
+		}
67
+
68
+		if (!isset($params['device_type'])) {
69
+			throw new BadParam("device_type must be provided.");
70
+		}
71
+
72
+		$deviceTypes = array(
73
+			DeviceType::IPHONE,
74
+			DeviceType::IPAD,
75
+			DeviceType::ANDROID_PHONE,
76
+			DeviceType::ANDROID_TABLET
77
+		);
78
+		if (!in_array($params['device_type'], $deviceTypes)) {
79
+			throw new BadParam("device_type is invalid.");
80
+		}
81
+
82
+		if (!isset($params['device_guid'])) {
83
+			throw new BadParam("device_guid must be provided.");
84
+		}
85
+
86
+		if (isset($params['device_timestamp'])) {
87
+			$template = '/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/i';
88
+			if (!preg_match($template, $params['device_timestamp'])) {
89
+				throw new BadParam("device_timestamp is invalid.");
90
+			}
91
+		}
92
+
93
+		$param->format = self::getValue($params, 'format');
94
+		$param->route_id = self::getValue($params, 'route_id');
95
+		$param->member_id = self::getValue($params, 'member_id');
96
+		$param->course = self::getValue($params, 'course');
97
+		$param->speed = self::getValue($params, 'speed');
98
+		$param->lat = self::getValue($params, 'lat');
99
+		$param->lng = self::getValue($params, 'lng');
100
+		$param->device_type = self::getValue($params, 'device_type');
101
+		$param->device_guid = self::getValue($params, 'device_guid');
102
+		$param->device_timestamp = self::getValue($params, 'device_timestamp');
103
+		$param->vehicle_id = self::getValue($params, 'vehicle_id');
104
+		$param->altitude = self::getValue($params, 'altitude');
105
+		$param->app_version = self::getValue($params, 'app_version');
106
+		$param->tx_id = self::getValue($params, 'tx_id');
107
+
108
+		return $param;
109
+	}
110 110
 }
Please login to merge, or discard this patch.
src/Route4Me/Vehicle.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,21 +11,21 @@
 block discarded – undo
11 11
 		
12 12
 		public static function fromArray(array $params) {
13 13
 			$vehicle= new Vehicle();
14
-	        foreach($params as $key => $value) {
15
-	            if (property_exists($vehicle, $key)) {
16
-	                $vehicle->{$key} = $value;
17
-	            }
14
+			foreach($params as $key => $value) {
15
+				if (property_exists($vehicle, $key)) {
16
+					$vehicle->{$key} = $value;
17
+				}
18 18
 			}
19 19
 			
20 20
 			return $order;
21 21
 		}
22 22
 		
23 23
 		public static function getVehicles()
24
-	    {
25
-	    	$response = Route4Me::makeRequst(array(
26
-	            'url'    => self::$apiUrl,
27
-	            'method' => 'GET'
28
-	        ));
24
+		{
25
+			$response = Route4Me::makeRequst(array(
26
+				'url'    => self::$apiUrl,
27
+				'method' => 'GET'
28
+			));
29 29
 
30 30
 			return $response;
31 31
 		}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 block discarded – undo
7 7
 	{
8 8
 		static public $apiUrl = '/api/vehicles/view_vehicles.php';
9 9
 		
10
-		public function __construct () {  }
10
+		public function __construct() {  }
11 11
 		
12 12
 		public static function fromArray(array $params) {
13
-			$vehicle= new Vehicle();
14
-	        foreach($params as $key => $value) {
13
+			$vehicle = new Vehicle();
14
+	        foreach ($params as $key => $value) {
15 15
 	            if (property_exists($vehicle, $key)) {
16 16
 	                $vehicle->{$key} = $value;
17 17
 	            }
Please login to merge, or discard this patch.
src/Route4Me/Territory.php 2 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -21,94 +21,94 @@
 block discarded – undo
21 21
 		
22 22
 		public static function fromArray(array $params) {
23 23
 			if (!isset($params['territory_name'])) {
24
-	            throw new BadParam('Territory name must be provided');
25
-	        }
24
+				throw new BadParam('Territory name must be provided');
25
+			}
26 26
 			
27 27
 			if (!isset($params['territory_color'])) {
28
-	            throw new BadParam('Territory color must be provided');
29
-	        }
28
+				throw new BadParam('Territory color must be provided');
29
+			}
30 30
 			
31 31
 			if (!isset($params['territory'])) {
32
-	            throw new BadParam('Territory must be provided');
33
-	        }
32
+				throw new BadParam('Territory must be provided');
33
+			}
34 34
 			
35 35
 			$territoryparameters = new Territory();
36
-	        foreach($params as $key => $value) {
37
-	            if (property_exists($territoryparameters, $key)) {
38
-	                $territoryparameters->{$key} = $value;
39
-	            }
36
+			foreach($params as $key => $value) {
37
+				if (property_exists($territoryparameters, $key)) {
38
+					$territoryparameters->{$key} = $value;
39
+				}
40 40
 			}
41 41
 			
42 42
 			return $territoryparameters;
43 43
 		}
44 44
 		
45 45
 		public static function getTerritory($params)
46
-	    {
47
-	        $territory = Route4Me::makeRequst(array(
48
-	            'url'    => self::$apiUrl,
49
-	            'method' => 'GET',
50
-	            'query'  => array(
51
-	                'territory_id' => isset($params['territory_id']) ? $params['territory_id']: null,
52
-	                'addresses' => isset($params['addresses']) ? $params['addresses']: null,
53
-	            )
54
-	        ));
46
+		{
47
+			$territory = Route4Me::makeRequst(array(
48
+				'url'    => self::$apiUrl,
49
+				'method' => 'GET',
50
+				'query'  => array(
51
+					'territory_id' => isset($params['territory_id']) ? $params['territory_id']: null,
52
+					'addresses' => isset($params['addresses']) ? $params['addresses']: null,
53
+				)
54
+			));
55 55
 	
56
-	        return $territory;
57
-	    }
56
+			return $territory;
57
+		}
58 58
 		
59 59
 		public static function getTerritories($params)
60
-	    {
61
-	        $response = Route4Me::makeRequst(array(
62
-	            'url'    => self::$apiUrl,
63
-	            'method' => 'GET',
64
-	            'query'  => array(
65
-	                'offset'  => isset($params->offset) ? $params->offset: null,
66
-	                'limit'   => isset($params->limit) ? $params->limit: null,
67
-	            )
68
-	        ));
60
+		{
61
+			$response = Route4Me::makeRequst(array(
62
+				'url'    => self::$apiUrl,
63
+				'method' => 'GET',
64
+				'query'  => array(
65
+					'offset'  => isset($params->offset) ? $params->offset: null,
66
+					'limit'   => isset($params->limit) ? $params->limit: null,
67
+				)
68
+			));
69 69
 	
70
-	        return $response;
71
-	    }
70
+			return $response;
71
+		}
72 72
 
73 73
 		public static function addTerritory($params)
74
-	    {
75
-	    	$response = Route4Me::makeRequst(array(
76
-	            'url'    => self::$apiUrl,
77
-	            'method' => 'ADD',
78
-	            'query'  => array(
79
-	            	'territory_name' => isset($params->territory_name) ? $params->territory_name: null,
80
-	                'territory_color' => isset($params->territory_color) ? $params->territory_color : null,
81
-	                'territory' => isset($params->territory) ? $params->territory : null,
82
-	            )
83
-	        ));
74
+		{
75
+			$response = Route4Me::makeRequst(array(
76
+				'url'    => self::$apiUrl,
77
+				'method' => 'ADD',
78
+				'query'  => array(
79
+					'territory_name' => isset($params->territory_name) ? $params->territory_name: null,
80
+					'territory_color' => isset($params->territory_color) ? $params->territory_color : null,
81
+					'territory' => isset($params->territory) ? $params->territory : null,
82
+				)
83
+			));
84 84
 
85 85
 			return $response;
86 86
 		}
87 87
 		
88 88
 		public function deleteTerritory($territory_id)
89
-	    {
90
-	        $result = Route4Me::makeRequst(array(
91
-	            'url'    => self::$apiUrl,
92
-	            'method' => 'DELETEARRAY',
93
-	            'query'  => array(
94
-	                'territory_id'  => $territory_id
95
-	            )
96
-	        ));
89
+		{
90
+			$result = Route4Me::makeRequst(array(
91
+				'url'    => self::$apiUrl,
92
+				'method' => 'DELETEARRAY',
93
+				'query'  => array(
94
+					'territory_id'  => $territory_id
95
+				)
96
+			));
97 97
 	
98
-	        return $result;
99
-	    }
98
+			return $result;
99
+		}
100 100
 		
101 101
 		public function updateTerritory($params)
102
-	    {
103
-	        $response = Route4Me::makeRequst(array(
104
-	            'url'    => self::$apiUrl,
105
-	            'method' => 'PUT',
106
-	            'query'   => (array)$params,
102
+		{
103
+			$response = Route4Me::makeRequst(array(
104
+				'url'    => self::$apiUrl,
105
+				'method' => 'PUT',
106
+				'query'   => (array)$params,
107 107
 
108
-	        ));
108
+			));
109 109
 	
110
-	        return $response;
111
-	    }
110
+			return $response;
111
+		}
112 112
 	}
113 113
 	
114 114
 ?>
115 115
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@  discard block
 block discarded – undo
8 8
 	{
9 9
 		static public $apiUrl = '/api.v4/territory.php';
10 10
 	
11
-		public $territory_id;  // Territory id
11
+		public $territory_id; // Territory id
12 12
 		public $territory_name; 
13 13
 		public $territory_color;
14 14
 		public $addresses;
15 15
 		public $member_id;
16 16
 		public $territory; // Territory parameters
17 17
 		
18
-		public function __construct () {
18
+		public function __construct() {
19 19
 			
20 20
 		}
21 21
 		
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	        }
34 34
 			
35 35
 			$territoryparameters = new Territory();
36
-	        foreach($params as $key => $value) {
36
+	        foreach ($params as $key => $value) {
37 37
 	            if (property_exists($territoryparameters, $key)) {
38 38
 	                $territoryparameters->{$key} = $value;
39 39
 	            }
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	            'url'    => self::$apiUrl,
49 49
 	            'method' => 'GET',
50 50
 	            'query'  => array(
51
-	                'territory_id' => isset($params['territory_id']) ? $params['territory_id']: null,
52
-	                'addresses' => isset($params['addresses']) ? $params['addresses']: null,
51
+	                'territory_id' => isset($params['territory_id']) ? $params['territory_id'] : null,
52
+	                'addresses' => isset($params['addresses']) ? $params['addresses'] : null,
53 53
 	            )
54 54
 	        ));
55 55
 	
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	            'url'    => self::$apiUrl,
63 63
 	            'method' => 'GET',
64 64
 	            'query'  => array(
65
-	                'offset'  => isset($params->offset) ? $params->offset: null,
66
-	                'limit'   => isset($params->limit) ? $params->limit: null,
65
+	                'offset'  => isset($params->offset) ? $params->offset : null,
66
+	                'limit'   => isset($params->limit) ? $params->limit : null,
67 67
 	            )
68 68
 	        ));
69 69
 	
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	            'url'    => self::$apiUrl,
77 77
 	            'method' => 'ADD',
78 78
 	            'query'  => array(
79
-	            	'territory_name' => isset($params->territory_name) ? $params->territory_name: null,
79
+	            	'territory_name' => isset($params->territory_name) ? $params->territory_name : null,
80 80
 	                'territory_color' => isset($params->territory_color) ? $params->territory_color : null,
81 81
 	                'territory' => isset($params->territory) ? $params->territory : null,
82 82
 	            )
Please login to merge, or discard this patch.
src/Route4Me/ActivityParameters.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -25,43 +25,43 @@  discard block
 block discarded – undo
25 25
 		
26 26
 		public static function fromArray(array $params) {
27 27
 			$activityparameters = new ActivityParameters();
28
-	        foreach($params as $key => $value) {
29
-	            if (property_exists($activityparameters, $key)) {
30
-	                $activityparameters->{$key} = $value;
31
-	            }
28
+			foreach($params as $key => $value) {
29
+				if (property_exists($activityparameters, $key)) {
30
+					$activityparameters->{$key} = $value;
31
+				}
32 32
 			}
33 33
 			
34 34
 			return $activityparameters;
35 35
 		}
36 36
 		
37 37
 		public static function get($params)
38
-	    {
39
-	    	$activity = Route4Me::makeRequst(array(
40
-	            'url'    => self::$apiUrl,
41
-	            'method' => 'GET',
42
-	            'query'  => array(
43
-	                'route_id' => isset($params->route_id) ? $params->route_id : null,
44
-	                'team' => isset($params->team) ? $params->team: null,
45
-	                'limit' => isset($params->limit) ? $params->limit: null,
46
-	                'offset' => isset($params->offset) ? $params->offset : null,
47
-	            )
48
-	        ));
38
+		{
39
+			$activity = Route4Me::makeRequst(array(
40
+				'url'    => self::$apiUrl,
41
+				'method' => 'GET',
42
+				'query'  => array(
43
+					'route_id' => isset($params->route_id) ? $params->route_id : null,
44
+					'team' => isset($params->team) ? $params->team: null,
45
+					'limit' => isset($params->limit) ? $params->limit: null,
46
+					'offset' => isset($params->offset) ? $params->offset : null,
47
+				)
48
+			));
49 49
 
50 50
 			return $activity;
51 51
 		}
52 52
 
53 53
 		public static function searcActivities($params)
54
-	    {
55
-	    	$activity = Route4Me::makeRequst(array(
56
-	            'url'    => self::$apiUrl,
57
-	            'method' => 'GET',
58
-	            'query'  => array(
59
-	                'route_id' => isset($params->route_id) ? $params->route_id : null,
60
-	                'limit' => isset($params->limit) ? $params->limit: null,
61
-	                'offset' => isset($params->offset) ? $params->offset : null,
62
-	                'activity_type' => isset($params->activity_type) ? $params->activity_type : null,
63
-	            )
64
-	        ));
54
+		{
55
+			$activity = Route4Me::makeRequst(array(
56
+				'url'    => self::$apiUrl,
57
+				'method' => 'GET',
58
+				'query'  => array(
59
+					'route_id' => isset($params->route_id) ? $params->route_id : null,
60
+					'limit' => isset($params->limit) ? $params->limit: null,
61
+					'offset' => isset($params->offset) ? $params->offset : null,
62
+					'activity_type' => isset($params->activity_type) ? $params->activity_type : null,
63
+				)
64
+			));
65 65
 
66 66
 			return $activity;
67 67
 		}
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 		public static function sendUserMessage($postParameters)
70 70
 		{
71 71
 			$result = Route4Me::makeRequst(array(
72
-	            'url'    => self::$apiUrlv4,
73
-	            'method' => 'POST',
74
-	            'body'  => array(
75
-	            	'activity_type' => isset($postParameters->activity_type) ? $postParameters->activity_type : null,
76
-	            	'activity_message' => isset($postParameters->activity_message) ? $postParameters->activity_message: null,
77
-	                'route_id' => isset($postParameters->route_id) ? $postParameters->route_id : null,
78
-	            )
79
-	        ));
72
+				'url'    => self::$apiUrlv4,
73
+				'method' => 'POST',
74
+				'body'  => array(
75
+					'activity_type' => isset($postParameters->activity_type) ? $postParameters->activity_type : null,
76
+					'activity_message' => isset($postParameters->activity_message) ? $postParameters->activity_message: null,
77
+					'route_id' => isset($postParameters->route_id) ? $postParameters->route_id : null,
78
+				)
79
+			));
80 80
 			
81 81
 			return $result;
82 82
 		}
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 		public $activity_type;
20 20
 		public $activity_message;
21 21
 		
22
-		public function __construct () {
22
+		public function __construct() {
23 23
 			
24 24
 		}
25 25
 		
26 26
 		public static function fromArray(array $params) {
27 27
 			$activityparameters = new ActivityParameters();
28
-	        foreach($params as $key => $value) {
28
+	        foreach ($params as $key => $value) {
29 29
 	            if (property_exists($activityparameters, $key)) {
30 30
 	                $activityparameters->{$key} = $value;
31 31
 	            }
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	            'method' => 'GET',
42 42
 	            'query'  => array(
43 43
 	                'route_id' => isset($params->route_id) ? $params->route_id : null,
44
-	                'team' => isset($params->team) ? $params->team: null,
45
-	                'limit' => isset($params->limit) ? $params->limit: null,
44
+	                'team' => isset($params->team) ? $params->team : null,
45
+	                'limit' => isset($params->limit) ? $params->limit : null,
46 46
 	                'offset' => isset($params->offset) ? $params->offset : null,
47 47
 	            )
48 48
 	        ));
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	            'method' => 'GET',
58 58
 	            'query'  => array(
59 59
 	                'route_id' => isset($params->route_id) ? $params->route_id : null,
60
-	                'limit' => isset($params->limit) ? $params->limit: null,
60
+	                'limit' => isset($params->limit) ? $params->limit : null,
61 61
 	                'offset' => isset($params->offset) ? $params->offset : null,
62 62
 	                'activity_type' => isset($params->activity_type) ? $params->activity_type : null,
63 63
 	            )
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	            'method' => 'POST',
74 74
 	            'body'  => array(
75 75
 	            	'activity_type' => isset($postParameters->activity_type) ? $postParameters->activity_type : null,
76
-	            	'activity_message' => isset($postParameters->activity_message) ? $postParameters->activity_message: null,
76
+	            	'activity_message' => isset($postParameters->activity_message) ? $postParameters->activity_message : null,
77 77
 	                'route_id' => isset($postParameters->route_id) ? $postParameters->route_id : null,
78 78
 	            )
79 79
 	        ));
Please login to merge, or discard this patch.
src/Route4Me/RouteParameters.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -6,54 +6,54 @@
 block discarded – undo
6 6
 
7 7
 class RouteParameters extends Common
8 8
 {
9
-    public $is_upload;
10
-    public $rt;
11
-    public $route_name;
12
-    public $route_date;
13
-    public $route_time;
14
-    public $shared_publicly;
15
-    public $disable_optimization;
16
-    public $optimize;
17
-    public $lock_last;
18
-    public $vehicle_capacity;
19
-    public $vehicle_max_distance_mi;
20
-    public $distance_unit;
21
-    public $travel_mode;
22
-    public $avoid;
23
-    public $vehicle_id;
24
-    public $dev_lat;
25
-    public $dev_lng;
26
-    public $route_max_duration;
27
-    public $route_email;
28
-    public $route_type = "api";
29
-    public $store_route = true;
30
-    public $metric;
31
-    public $algorithm_type;
32
-    public $member_id;
33
-    public $ip;
34
-    public $dm;
35
-    public $dirm;
36
-    public $parts;
37
-    public $device_id;
38
-    public $device_type;
39
-    public $has_trailer;
40
-    public $trailer_weight_t;
41
-    public $limited_weight_t;
42
-    public $weight_per_axle_t;
43
-    public $truck_height_meters;
44
-    public $truck_width_meters;
45
-    public $truck_length_meters;
46
-    public $truck_hazardous_goods;
9
+	public $is_upload;
10
+	public $rt;
11
+	public $route_name;
12
+	public $route_date;
13
+	public $route_time;
14
+	public $shared_publicly;
15
+	public $disable_optimization;
16
+	public $optimize;
17
+	public $lock_last;
18
+	public $vehicle_capacity;
19
+	public $vehicle_max_distance_mi;
20
+	public $distance_unit;
21
+	public $travel_mode;
22
+	public $avoid;
23
+	public $vehicle_id;
24
+	public $dev_lat;
25
+	public $dev_lng;
26
+	public $route_max_duration;
27
+	public $route_email;
28
+	public $route_type = "api";
29
+	public $store_route = true;
30
+	public $metric;
31
+	public $algorithm_type;
32
+	public $member_id;
33
+	public $ip;
34
+	public $dm;
35
+	public $dirm;
36
+	public $parts;
37
+	public $device_id;
38
+	public $device_type;
39
+	public $has_trailer;
40
+	public $trailer_weight_t;
41
+	public $limited_weight_t;
42
+	public $weight_per_axle_t;
43
+	public $truck_height_meters;
44
+	public $truck_width_meters;
45
+	public $truck_length_meters;
46
+	public $truck_hazardous_goods;
47 47
 
48
-    public static function fromArray(array $params)
49
-    {
50
-        $routeParams = new RouteParameters();
51
-        foreach($params as $key => $value) {
52
-            if (property_exists($routeParams, $key)) {
53
-                $routeParams->{$key} = $value;
54
-            }
55
-        }
48
+	public static function fromArray(array $params)
49
+	{
50
+		$routeParams = new RouteParameters();
51
+		foreach($params as $key => $value) {
52
+			if (property_exists($routeParams, $key)) {
53
+				$routeParams->{$key} = $value;
54
+			}
55
+		}
56 56
 
57
-        return $routeParams;
58
-    }
57
+		return $routeParams;
58
+	}
59 59
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
     public static function fromArray(array $params)
49 49
     {
50 50
         $routeParams = new RouteParameters();
51
-        foreach($params as $key => $value) {
51
+        foreach ($params as $key => $value) {
52 52
             if (property_exists($routeParams, $key)) {
53 53
                 $routeParams->{$key} = $value;
54 54
             }
Please login to merge, or discard this patch.
src/Route4Me/MyQ.php 4 patches
Unused Use Statements   +1 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,13 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Route4Me;
3 3
 
4
-use Route4Me\Common;
5
-/**
6
- * class MyQ
7
- *
8
- * Offers authentication to MyQ API, and access to garage door open/close/status functions
9
- *
10
- */
4
+
11 5
 class MyQException extends \Exception {}
12 6
 class MyQ {
13 7
     
Please login to merge, or discard this patch.
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -11,174 +11,174 @@
 block discarded – undo
11 11
 class MyQException extends \Exception {}
12 12
 class MyQ {
13 13
     
14
-    /** @var string|null $username contains the username used to authenticate with the MyQ API */
15
-    protected $username = null;
16
-    /** @var string|null $password contains the password used to authenticate with the MyQ API */
17
-    protected $password = null;
18
-    /** @var string|null $appId is the application ID used to register with the MyQ API */
19
-    protected $appId = 'NWknvuBd7LoFHfXmKNMBcgajXtZEgKUh4V7WNzMidrpUUluDpVYVZx+xT4PCM5Kx';
20
-    //protected $appId = 'Vj8pQggXLhLy0WHahglCD4N1nAkkXQtGYpq2HrHD7H1nvmbT55KqtN6RSF4ILB%2fi';
21
-    /** @var string|null $securityToken is the auth token returned after a successful login */
22
-    protected $securityToken = null;
23
-    /** @var string|null $userAgent is the User-Agent header value sent with each API request */
24
-    protected $userAgent = 'Chamberlain/3.4.1';
25
-    /** @var string|null $culture is the API culture code for the API */
26
-    protected $culture = 'en';
27
-    /** @var string|null $contentType is the content type used for all cURL requests */
28
-    protected $contentType = 'application/json';
29
-    /** @var array $headers contain HTTP headers for cURL requests */
30
-    protected $_headers = array();
31
-    protected $_deviceId = null;
32
-    protected $_locationName = null;
33
-    protected $_doorName = null;
34
-    protected $_loginUrl = 'https://myqexternal.myqdevice.com/api/v4/User/Validate';
35
-    protected $_getDeviceDetailUrl = 'https://myqexternal.myqdevice.com/api/v4/userdevicedetails/get?&filterOn=true';
36
-    protected $_putDeviceStateUrl = '/api/v4/DeviceAttribute/PutDeviceAttribute';
37
-    /** @var resource|null $_conn is the web connection to the MyQ API */
38
-    protected $_conn = null;
39
-    /**
40
-     * Initializes class. Optionally allows user to override variables
41
-     *
42
-     * @param array $params A associative array for overwriting class variables
43
-     *
44
-     * @return MyQ
45
-     */
46
-    public function __construct ($params = array()) {
47
-        // Overwrite class variables
48
-        foreach ($params as $k => $v) {
49
-            $this->$k = $v;
50
-        }
51
-        // Initialize cURL request headers
52
-        if (sizeof($this->_headers) == 0) {
53
-            $this->_headers = array (
54
-                'MyQApplicationId' => $this->appId,
55
-                'Culture' => $this->culture,
56
-                'Content-Type' => $this->contentType,
57
-                'User-Agent' => $this->userAgent,
58
-            );
59
-        }
60
-        // Initialize cURL connection
61
-        $this->_init();
62
-        return $this;
63
-    }
64
-    /**
65
-     * Perform a login request
66
-     *
67
-     * @param string|null $username Username to use when logging in
68
-     * @param string|null $password Password to use for logging in
69
-     *
70
-     * @return MyQ
71
-     */
72
-    public function login ($username = null, $password = null) {
73
-        // Set username/password if not null
74
-        if (!is_null($username)) {
75
-            $this->username = $username;
76
-        }
77
-        if (!is_null($password)) {
78
-            $this->password = $password;
79
-        }
80
-        // confirm that we have a valid username/password
81
-        $error = array();
82
-        if (is_null($this->username)) {
83
-            $error[] = 'username';
84
-        }
85
-        if (is_null($this->password)) {
86
-            $error[] = 'password';
87
-        }
88
-        if (sizeof($error) > 0) {
89
-            throw new MyQException('Missing required auth credential: ' . implode(',', $error));
90
-        }
91
-        $this->_login();
92
-    }
93
-    public function getState () {
94
-        $this->_getDetails();
95
-        $timeInState = time() - $this->_doorStateTime;
96
-        echo implode(',', array (
97
-            $this->_locationName,
98
-            $this->_doorName,
99
-            $this->_doorState,
100
-            (int)$timeInState,
101
-        ));
102
-    }
14
+	/** @var string|null $username contains the username used to authenticate with the MyQ API */
15
+	protected $username = null;
16
+	/** @var string|null $password contains the password used to authenticate with the MyQ API */
17
+	protected $password = null;
18
+	/** @var string|null $appId is the application ID used to register with the MyQ API */
19
+	protected $appId = 'NWknvuBd7LoFHfXmKNMBcgajXtZEgKUh4V7WNzMidrpUUluDpVYVZx+xT4PCM5Kx';
20
+	//protected $appId = 'Vj8pQggXLhLy0WHahglCD4N1nAkkXQtGYpq2HrHD7H1nvmbT55KqtN6RSF4ILB%2fi';
21
+	/** @var string|null $securityToken is the auth token returned after a successful login */
22
+	protected $securityToken = null;
23
+	/** @var string|null $userAgent is the User-Agent header value sent with each API request */
24
+	protected $userAgent = 'Chamberlain/3.4.1';
25
+	/** @var string|null $culture is the API culture code for the API */
26
+	protected $culture = 'en';
27
+	/** @var string|null $contentType is the content type used for all cURL requests */
28
+	protected $contentType = 'application/json';
29
+	/** @var array $headers contain HTTP headers for cURL requests */
30
+	protected $_headers = array();
31
+	protected $_deviceId = null;
32
+	protected $_locationName = null;
33
+	protected $_doorName = null;
34
+	protected $_loginUrl = 'https://myqexternal.myqdevice.com/api/v4/User/Validate';
35
+	protected $_getDeviceDetailUrl = 'https://myqexternal.myqdevice.com/api/v4/userdevicedetails/get?&filterOn=true';
36
+	protected $_putDeviceStateUrl = '/api/v4/DeviceAttribute/PutDeviceAttribute';
37
+	/** @var resource|null $_conn is the web connection to the MyQ API */
38
+	protected $_conn = null;
39
+	/**
40
+	 * Initializes class. Optionally allows user to override variables
41
+	 *
42
+	 * @param array $params A associative array for overwriting class variables
43
+	 *
44
+	 * @return MyQ
45
+	 */
46
+	public function __construct ($params = array()) {
47
+		// Overwrite class variables
48
+		foreach ($params as $k => $v) {
49
+			$this->$k = $v;
50
+		}
51
+		// Initialize cURL request headers
52
+		if (sizeof($this->_headers) == 0) {
53
+			$this->_headers = array (
54
+				'MyQApplicationId' => $this->appId,
55
+				'Culture' => $this->culture,
56
+				'Content-Type' => $this->contentType,
57
+				'User-Agent' => $this->userAgent,
58
+			);
59
+		}
60
+		// Initialize cURL connection
61
+		$this->_init();
62
+		return $this;
63
+	}
64
+	/**
65
+	 * Perform a login request
66
+	 *
67
+	 * @param string|null $username Username to use when logging in
68
+	 * @param string|null $password Password to use for logging in
69
+	 *
70
+	 * @return MyQ
71
+	 */
72
+	public function login ($username = null, $password = null) {
73
+		// Set username/password if not null
74
+		if (!is_null($username)) {
75
+			$this->username = $username;
76
+		}
77
+		if (!is_null($password)) {
78
+			$this->password = $password;
79
+		}
80
+		// confirm that we have a valid username/password
81
+		$error = array();
82
+		if (is_null($this->username)) {
83
+			$error[] = 'username';
84
+		}
85
+		if (is_null($this->password)) {
86
+			$error[] = 'password';
87
+		}
88
+		if (sizeof($error) > 0) {
89
+			throw new MyQException('Missing required auth credential: ' . implode(',', $error));
90
+		}
91
+		$this->_login();
92
+	}
93
+	public function getState () {
94
+		$this->_getDetails();
95
+		$timeInState = time() - $this->_doorStateTime;
96
+		echo implode(',', array (
97
+			$this->_locationName,
98
+			$this->_doorName,
99
+			$this->_doorState,
100
+			(int)$timeInState,
101
+		));
102
+	}
103 103
 	
104 104
 	public function getDetails() {
105 105
 		return $this->_getDetails();
106 106
 	}
107 107
 	
108
-    private function _init () {
109
-        if (!isset($this->_conn)) {
110
-            $this->_conn = curl_init();
111
-            curl_setopt_array($this->_conn, array (
112
-                CURLOPT_RETURNTRANSFER => true,
113
-                CURLOPT_ENCODING => "",
114
-                CURLOPT_MAXREDIRS => 10,
115
-                CURLOPT_TIMEOUT => 30,
116
-                CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
117
-                CURLOPT_FAILONERROR => true,
118
-                CURLOPT_FOLLOWLOCATION => true,
119
-                CURLOPT_FRESH_CONNECT => true,
120
-                CURLOPT_FORBID_REUSE => true,
121
-                CURLOPT_USERAGENT => $this->userAgent,
122
-            ));
123
-        }
124
-        $this->_setHeaders();
125
-    }
126
-    private function _setHeaders () {
127
-        $headers = array();
128
-        foreach ($this->_headers as $k => $v) {
129
-            $headers[] = "$k: $v";
130
-        }
131
-        curl_setopt($this->_conn, CURLOPT_HTTPHEADER, $headers);
132
-    }
133
-    private function _login () {
134
-        $this->_init();
135
-        curl_setopt($this->_conn, CURLOPT_CUSTOMREQUEST, 'POST');
136
-        curl_setopt($this->_conn, CURLOPT_URL, $this->_loginUrl);
137
-        $post = json_encode(array('username' => $this->username, 'password' => $this->password));
138
-        curl_setopt($this->_conn, CURLOPT_POSTFIELDS, $post);
139
-        $output = curl_exec($this->_conn);
140
-        $data = json_decode($output);
141
-        if ($data == false || !isset($data->SecurityToken)) {
142
-            throw new MyQException("Error processing login request: $output");
143
-        }
144
-        $this->_headers['SecurityToken'] = $data->SecurityToken;
145
-        return $this;
146
-    }
147
-    private function _getDetails () {
148
-        $this->_init();
149
-        curl_setopt($this->_conn, CURLOPT_CUSTOMREQUEST, 'GET');
150
-        curl_setopt($this->_conn, CURLOPT_URL, $this->_getDeviceDetailUrl);
151
-        $output = curl_exec($this->_conn);
152
-        $data = json_decode($output);
153
-        if ($data == false || !isset($data->Devices)) {
154
-            throw new MyQException("Error fetching device details: $output");
155
-        }
156
-        // Find our door device ID
157
-        foreach ($data->Devices as $device) {
158
-            if (stripos($device->MyQDeviceTypeName, "Gateway") !== false) {
159
-                // Find location name
160
-                foreach ($device->Attributes as $attr) {
161
-                    if ($attr->AttributeDisplayName == 'desc') {
162
-                        $this->_locationName = $attr->Value;
163
-                    }
164
-                }
165
-            }
108
+	private function _init () {
109
+		if (!isset($this->_conn)) {
110
+			$this->_conn = curl_init();
111
+			curl_setopt_array($this->_conn, array (
112
+				CURLOPT_RETURNTRANSFER => true,
113
+				CURLOPT_ENCODING => "",
114
+				CURLOPT_MAXREDIRS => 10,
115
+				CURLOPT_TIMEOUT => 30,
116
+				CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
117
+				CURLOPT_FAILONERROR => true,
118
+				CURLOPT_FOLLOWLOCATION => true,
119
+				CURLOPT_FRESH_CONNECT => true,
120
+				CURLOPT_FORBID_REUSE => true,
121
+				CURLOPT_USERAGENT => $this->userAgent,
122
+			));
123
+		}
124
+		$this->_setHeaders();
125
+	}
126
+	private function _setHeaders () {
127
+		$headers = array();
128
+		foreach ($this->_headers as $k => $v) {
129
+			$headers[] = "$k: $v";
130
+		}
131
+		curl_setopt($this->_conn, CURLOPT_HTTPHEADER, $headers);
132
+	}
133
+	private function _login () {
134
+		$this->_init();
135
+		curl_setopt($this->_conn, CURLOPT_CUSTOMREQUEST, 'POST');
136
+		curl_setopt($this->_conn, CURLOPT_URL, $this->_loginUrl);
137
+		$post = json_encode(array('username' => $this->username, 'password' => $this->password));
138
+		curl_setopt($this->_conn, CURLOPT_POSTFIELDS, $post);
139
+		$output = curl_exec($this->_conn);
140
+		$data = json_decode($output);
141
+		if ($data == false || !isset($data->SecurityToken)) {
142
+			throw new MyQException("Error processing login request: $output");
143
+		}
144
+		$this->_headers['SecurityToken'] = $data->SecurityToken;
145
+		return $this;
146
+	}
147
+	private function _getDetails () {
148
+		$this->_init();
149
+		curl_setopt($this->_conn, CURLOPT_CUSTOMREQUEST, 'GET');
150
+		curl_setopt($this->_conn, CURLOPT_URL, $this->_getDeviceDetailUrl);
151
+		$output = curl_exec($this->_conn);
152
+		$data = json_decode($output);
153
+		if ($data == false || !isset($data->Devices)) {
154
+			throw new MyQException("Error fetching device details: $output");
155
+		}
156
+		// Find our door device ID
157
+		foreach ($data->Devices as $device) {
158
+			if (stripos($device->MyQDeviceTypeName, "Gateway") !== false) {
159
+				// Find location name
160
+				foreach ($device->Attributes as $attr) {
161
+					if ($attr->AttributeDisplayName == 'desc') {
162
+						$this->_locationName = $attr->Value;
163
+					}
164
+				}
165
+			}
166 166
             
167
-            $this->_deviceId = $device->MyQDeviceId;
168
-            foreach ($device->Attributes as $attr) {
169
-                switch ($attr->AttributeDisplayName) {
170
-                    case 'desc':
171
-                        $this->_doorName = $attr->Value;
172
-                        break;
173
-                    case 'doorstate':
174
-                        $this->_doorState = $attr->Value;
175
-                        // UpdatedTime is a timestamp in ms, so we truncate
176
-                        $this->_doorStateTime = (int)$attr->UpdatedTime / 1000;
177
-                        break;
178
-                    default:
179
-                        continue;
180
-                }
181
-            }
182
-        }
183
-    }
167
+			$this->_deviceId = $device->MyQDeviceId;
168
+			foreach ($device->Attributes as $attr) {
169
+				switch ($attr->AttributeDisplayName) {
170
+					case 'desc':
171
+						$this->_doorName = $attr->Value;
172
+						break;
173
+					case 'doorstate':
174
+						$this->_doorState = $attr->Value;
175
+						// UpdatedTime is a timestamp in ms, so we truncate
176
+						$this->_doorStateTime = (int)$attr->UpdatedTime / 1000;
177
+						break;
178
+					default:
179
+						continue;
180
+				}
181
+			}
182
+		}
183
+	}
184 184
 }
185 185
\ No newline at end of file
Please login to merge, or discard this patch.
Switch Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -167,16 +167,16 @@
 block discarded – undo
167 167
             $this->_deviceId = $device->MyQDeviceId;
168 168
             foreach ($device->Attributes as $attr) {
169 169
                 switch ($attr->AttributeDisplayName) {
170
-                    case 'desc':
171
-                        $this->_doorName = $attr->Value;
172
-                        break;
173
-                    case 'doorstate':
174
-                        $this->_doorState = $attr->Value;
175
-                        // UpdatedTime is a timestamp in ms, so we truncate
176
-                        $this->_doorStateTime = (int)$attr->UpdatedTime / 1000;
177
-                        break;
178
-                    default:
179
-                        continue;
170
+                case 'desc':
171
+                    $this->_doorName = $attr->Value;
172
+                    break;
173
+                case 'doorstate':
174
+                    $this->_doorState = $attr->Value;
175
+                    // UpdatedTime is a timestamp in ms, so we truncate
176
+                    $this->_doorStateTime = (int)$attr->UpdatedTime / 1000;
177
+                    break;
178
+                default:
179
+                    continue;
180 180
                 }
181 181
             }
182 182
         }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
      *
44 44
      * @return MyQ
45 45
      */
46
-    public function __construct ($params = array()) {
46
+    public function __construct($params = array()) {
47 47
         // Overwrite class variables
48 48
         foreach ($params as $k => $v) {
49 49
             $this->$k = $v;
50 50
         }
51 51
         // Initialize cURL request headers
52
-        if (sizeof($this->_headers) == 0) {
53
-            $this->_headers = array (
52
+        if (sizeof($this->_headers)==0) {
53
+            $this->_headers = array(
54 54
                 'MyQApplicationId' => $this->appId,
55 55
                 'Culture' => $this->culture,
56 56
                 'Content-Type' => $this->contentType,
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      *
70 70
      * @return MyQ
71 71
      */
72
-    public function login ($username = null, $password = null) {
72
+    public function login($username = null, $password = null) {
73 73
         // Set username/password if not null
74 74
         if (!is_null($username)) {
75 75
             $this->username = $username;
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
         if (is_null($this->password)) {
86 86
             $error[] = 'password';
87 87
         }
88
-        if (sizeof($error) > 0) {
89
-            throw new MyQException('Missing required auth credential: ' . implode(',', $error));
88
+        if (sizeof($error)>0) {
89
+            throw new MyQException('Missing required auth credential: '.implode(',', $error));
90 90
         }
91 91
         $this->_login();
92 92
     }
93
-    public function getState () {
93
+    public function getState() {
94 94
         $this->_getDetails();
95 95
         $timeInState = time() - $this->_doorStateTime;
96
-        echo implode(',', array (
96
+        echo implode(',', array(
97 97
             $this->_locationName,
98 98
             $this->_doorName,
99 99
             $this->_doorState,
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
 		return $this->_getDetails();
106 106
 	}
107 107
 	
108
-    private function _init () {
108
+    private function _init() {
109 109
         if (!isset($this->_conn)) {
110 110
             $this->_conn = curl_init();
111
-            curl_setopt_array($this->_conn, array (
111
+            curl_setopt_array($this->_conn, array(
112 112
                 CURLOPT_RETURNTRANSFER => true,
113 113
                 CURLOPT_ENCODING => "",
114 114
                 CURLOPT_MAXREDIRS => 10,
@@ -123,14 +123,14 @@  discard block
 block discarded – undo
123 123
         }
124 124
         $this->_setHeaders();
125 125
     }
126
-    private function _setHeaders () {
126
+    private function _setHeaders() {
127 127
         $headers = array();
128 128
         foreach ($this->_headers as $k => $v) {
129 129
             $headers[] = "$k: $v";
130 130
         }
131 131
         curl_setopt($this->_conn, CURLOPT_HTTPHEADER, $headers);
132 132
     }
133
-    private function _login () {
133
+    private function _login() {
134 134
         $this->_init();
135 135
         curl_setopt($this->_conn, CURLOPT_CUSTOMREQUEST, 'POST');
136 136
         curl_setopt($this->_conn, CURLOPT_URL, $this->_loginUrl);
@@ -138,27 +138,27 @@  discard block
 block discarded – undo
138 138
         curl_setopt($this->_conn, CURLOPT_POSTFIELDS, $post);
139 139
         $output = curl_exec($this->_conn);
140 140
         $data = json_decode($output);
141
-        if ($data == false || !isset($data->SecurityToken)) {
141
+        if ($data==false || !isset($data->SecurityToken)) {
142 142
             throw new MyQException("Error processing login request: $output");
143 143
         }
144 144
         $this->_headers['SecurityToken'] = $data->SecurityToken;
145 145
         return $this;
146 146
     }
147
-    private function _getDetails () {
147
+    private function _getDetails() {
148 148
         $this->_init();
149 149
         curl_setopt($this->_conn, CURLOPT_CUSTOMREQUEST, 'GET');
150 150
         curl_setopt($this->_conn, CURLOPT_URL, $this->_getDeviceDetailUrl);
151 151
         $output = curl_exec($this->_conn);
152 152
         $data = json_decode($output);
153
-        if ($data == false || !isset($data->Devices)) {
153
+        if ($data==false || !isset($data->Devices)) {
154 154
             throw new MyQException("Error fetching device details: $output");
155 155
         }
156 156
         // Find our door device ID
157 157
         foreach ($data->Devices as $device) {
158
-            if (stripos($device->MyQDeviceTypeName, "Gateway") !== false) {
158
+            if (stripos($device->MyQDeviceTypeName, "Gateway")!==false) {
159 159
                 // Find location name
160 160
                 foreach ($device->Attributes as $attr) {
161
-                    if ($attr->AttributeDisplayName == 'desc') {
161
+                    if ($attr->AttributeDisplayName=='desc') {
162 162
                         $this->_locationName = $attr->Value;
163 163
                     }
164 164
                 }
Please login to merge, or discard this patch.
examples/AvoidanceZones/DeleteAvoidanceZone.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 	
4 4
 	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
5 5
 
6
-    require $vdir.'/../vendor/autoload.php';
6
+	require $vdir.'/../vendor/autoload.php';
7 7
 	
8 8
 	use Route4Me\Route4Me;
9 9
 	use Route4Me\Enum\TerritoryTypes;
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	namespace Route4Me;
3 3
 	
4
-	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
4
+	$vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
5 5
 
6 6
     require $vdir.'/../vendor/autoload.php';
7 7
 	
@@ -13,23 +13,23 @@  discard block
 block discarded – undo
13 13
 	// Add Avoidance Zone and get territory_id
14 14
 	//---------------------------------------------------------
15 15
 	$territory = new Territory();
16
-	$territory->type =  TerritoryTypes::CIRCLE;
17
-	$territory->data = array (
16
+	$territory->type = TerritoryTypes::CIRCLE;
17
+	$territory->data = array(
18 18
 		"37.569752822786455,-77.47833251953125",
19 19
 		"5000"
20 20
 	);
21 21
 	
22
-	$AvoisanceZoneParameters=AvoidanceZone::fromArray(array(
23
-		"territory_name"	=> "Test Territory ".strval(rand(10000,99999)),
22
+	$AvoisanceZoneParameters = AvoidanceZone::fromArray(array(
23
+		"territory_name"	=> "Test Territory ".strval(rand(10000, 99999)),
24 24
 		"territory_color"	=> "ff7700",
25 25
 		"territory"	=> $territory
26 26
 	));
27 27
 	
28
-	$avoidancezone=new AvoidanceZone();
28
+	$avoidancezone = new AvoidanceZone();
29 29
 	
30 30
 	$result = (array)$avoidancezone->addAvoidanceZone($AvoisanceZoneParameters);
31 31
 	
32
-	$territory_id="";
32
+	$territory_id = "";
33 33
 	if (isset($result)) {
34 34
 		$territory_id = $result["territory_id"];
35 35
 	} else {
Please login to merge, or discard this patch.
examples/GarageDoorOpener/get_myq_devices.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
3
-    require $vdir.'/../vendor/autoload.php';
3
+	require $vdir.'/../vendor/autoload.php';
4 4
 	
5 5
 	use Route4Me\MyQ;
6 6
 	
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-	$vdir=$_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
2
+	$vdir = $_SERVER['DOCUMENT_ROOT'].'/route4me/examples/';
3 3
     require $vdir.'/../vendor/autoload.php';
4 4
 	
5 5
 	use Route4Me\MyQ;
Please login to merge, or discard this patch.