Completed
Push — master ( 0cefbf...e1a6e6 )
by Davide
13:33
created
src/DavidePastore/Ipinfo/Host.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * Create an Host object with all the properties.
20 20
 	 * @param unknown $properties
21 21
 	 */
22
-	public function __construct($properties = array()){
22
+	public function __construct($properties = array()) {
23 23
 		if (!$properties) {
24 24
 			$properties = array();
25 25
 		}
@@ -40,63 +40,63 @@  discard block
 block discarded – undo
40 40
 	/**
41 41
 	 * Get the city value.
42 42
 	 */
43
-	public function getCity(){
43
+	public function getCity() {
44 44
 		return $this->properties[Ipinfo::CITY];
45 45
 	}
46 46
 	
47 47
 	/**
48 48
 	 * Get the country value.
49 49
 	 */
50
-	public function getCountry(){
50
+	public function getCountry() {
51 51
 		return $this->properties[Ipinfo::COUNTRY];
52 52
 	}
53 53
 	
54 54
 	/**
55 55
 	 * Get the hostname value.
56 56
 	 */
57
-	public function getHostname(){
57
+	public function getHostname() {
58 58
 		return $this->properties[Ipinfo::HOSTNAME];
59 59
 	}
60 60
 
61 61
 	/**
62 62
 	 * Get the ip value.
63 63
 	 */
64
-	public function getIp(){
64
+	public function getIp() {
65 65
 		return $this->properties[Ipinfo::IP];
66 66
 	}
67 67
 	
68 68
 	/**
69 69
 	 * Get the loc value.
70 70
 	 */
71
-	public function getLoc(){
71
+	public function getLoc() {
72 72
 		return $this->properties[Ipinfo::LOC];
73 73
 	}
74 74
 
75 75
 	/**
76 76
 	 * Get the org value.
77 77
 	 */
78
-	public function getOrg(){
78
+	public function getOrg() {
79 79
 		return $this->properties[Ipinfo::ORG];
80 80
 	}
81 81
 	
82 82
 	/**
83 83
 	 * Get the phone value.
84 84
 	 */
85
-	public function getPhone(){
85
+	public function getPhone() {
86 86
 		return $this->properties[Ipinfo::PHONE];
87 87
 	}
88 88
     
89 89
     /**
90 90
 	 * Get the postal value.
91 91
 	 */
92
-	public function getPostal(){
92
+	public function getPostal() {
93 93
 		return $this->properties[Ipinfo::POSTAL];
94 94
 	}
95 95
 
96 96
 	/**
97 97
 	 * Get the region value.
98 98
 	 */
99
-	public function getRegion(){
99
+	public function getRegion() {
100 100
 		return $this->properties[Ipinfo::REGION];
101 101
 	}
102 102
 	
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * Get all the properties.
105 105
 	 * @return array An associative array with all the properties.
106 106
 	 */
107
-	public function getProperties(){
107
+	public function getProperties() {
108 108
 		return $this->properties;
109 109
 	}
110 110
 }
111 111
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
 	 */
70 70
 	const GEO = "geo";
71 71
     
72
-    /**
72
+	/**
73 73
 	 * The postal string.
74 74
 	 * @var string
75 75
 	 */
Please login to merge, or discard this patch.
src/DavidePastore/Ipinfo/Ipinfo.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
 	 */
70 70
 	const GEO = "geo";
71 71
     
72
-    /**
72
+	/**
73 73
 	 * The postal string.
74 74
 	 * @var string
75 75
 	 */
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * - token: string the developer token;
89 89
 	 * - debug: boolean active or not the debug.
90 90
 	 */
91
-	public function __construct($settings = array()){
91
+	public function __construct($settings = array()) {
92 92
 		//Merge user settings
93 93
 		$this->settings = array_merge(array(
94 94
 				'token' => '',
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * Get all the info about your own ip address.
102 102
 	 * @return \DavidePastore\Ipinfo\Host The Host object with all the info.
103 103
 	 */
104
-	public function getYourOwnIpDetails(){
104
+	public function getYourOwnIpDetails() {
105 105
 		$response = $this->makeCurlRequest($this::BASE_URL . "json");
106 106
 		$response = json_decode($response, true);
107 107
 		return new Host($response);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @param string $ipAddress The ip address.
113 113
 	 * @return \DavidePastore\Ipinfo\Host The Host object with all the info.
114 114
 	 */
115
-	public function getFullIpDetails($ipAddress){
115
+	public function getFullIpDetails($ipAddress) {
116 116
 		$response = $this->makeCurlRequest($this::BASE_URL . $ipAddress);
117 117
 		$response = json_decode($response, true);
118 118
 		return new Host($response);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * This could returns an Host object if you call it with for the field
127 127
 	 * \DavidePastore\Ipinfo\Ipinfo::GEO.
128 128
 	 */
129
-	public function getSpecificField($ipAddress, $field){
129
+	public function getSpecificField($ipAddress, $field) {
130 130
 		$response = $this->makeCurlRequest($this::BASE_URL . $ipAddress . "/" . $field);
131 131
 		$response = $this->checkGeo($field, $response);
132 132
 		return $response;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 * This could returns an Host object if you call it with for the field
140 140
 	 * \DavidePastore\Ipinfo\Ipinfo::GEO.
141 141
 	 */
142
-	public function getYourOwnIpSpecificField($field){
142
+	public function getYourOwnIpSpecificField($field) {
143 143
 		$response = $this->makeCurlRequest($this::BASE_URL . $field);
144 144
 		$response = $this->checkGeo($field, $response);
145 145
 		return $response;
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
 	 * of the GEO type, a string otherwise. If the field value is different from the GEO type, it will
166 166
 	 * delete the last character ('\n').
167 167
 	 */
168
-	private function checkGeo($field, $response){
169
-		if($field == $this::GEO){
168
+	private function checkGeo($field, $response) {
169
+		if ($field == $this::GEO) {
170 170
 			$response = json_decode($response, true);
171 171
 			$response = new Host($response);
172 172
 		}
173
-		else{
173
+		else {
174 174
 			$response = substr($response, 0, -1);
175 175
 		}
176 176
 		
@@ -182,14 +182,14 @@  discard block
 block discarded – undo
182 182
 	 * @param string $address The address of the request.
183 183
 	 * @return string Returns the response from the request.
184 184
 	 */
185
-	private function makeCurlRequest($address){
185
+	private function makeCurlRequest($address) {
186 186
 		$curl = curl_init();
187 187
 		
188
-		if(!empty($this->settings['token'])){
188
+		if (!empty($this->settings['token'])) {
189 189
 			$address .= "?token=" . $this->settings['token'];
190 190
 		}
191 191
 		
192
-		if($this->settings['debug']){
192
+		if ($this->settings['debug']) {
193 193
 			echo "Request address: " . $address . "\n";
194 194
 		}
195 195
 		
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -169,8 +169,7 @@
 block discarded – undo
169 169
 		if($field == $this::GEO){
170 170
 			$response = json_decode($response, true);
171 171
 			$response = new Host($response);
172
-		}
173
-		else{
172
+		} else{
174 173
 			$response = substr($response, 0, -1);
175 174
 		}
176 175
 		
Please login to merge, or discard this patch.