Passed
Push — master ( 4fce34...402a34 )
by Michele
03:07
created
src/Qapla.php 1 patch
Braces   +27 added lines, -9 removed lines patch added patch discarded remove patch
@@ -46,7 +46,9 @@  discard block
 block discarded – undo
46 46
 			'lang' => $lang]
47 47
 		]);
48 48
 		$result = GuzzleHttp\json_decode($res->getBody());
49
-		if($result->getTrack->result == 'KO') return $result->getTrack->error;
49
+		if($result->getTrack->result == 'KO') {
50
+			return $result->getTrack->error;
51
+		}
50 52
 		return $result->getTrack;
51 53
 	}
52 54
 
@@ -82,7 +84,9 @@  discard block
 block discarded – undo
82 84
 	{
83 85
 		$param_name = 'dateFrom';
84 86
 		$date_or_days ?: $date_or_days = config('qapla.orders.default_fromDate');
85
-		if(strtotime($date_or_days) === false) $param_name = 'days';
87
+		if(strtotime($date_or_days) === false) {
88
+			$param_name = 'days';
89
+		}
86 90
 
87 91
 		$client = new GuzzleHttp\Client();
88 92
 		$res = $client->get(config('qapla.url').'getTracks/', ['query' =>  [
@@ -90,7 +94,9 @@  discard block
 block discarded – undo
90 94
 			$param_name => $date_or_days]
91 95
 		]);
92 96
 		$result = GuzzleHttp\json_decode($res->getBody());
93
-		if($result->getTracks->result == 'KO') return $result->getTracks->error;
97
+		if($result->getTracks->result == 'KO') {
98
+			return $result->getTracks->error;
99
+		}
94 100
 		return $result->getTracks->tracks;
95 101
 	}
96 102
 
@@ -108,7 +114,9 @@  discard block
 block discarded – undo
108 114
 			'trackingNumber'    => $trackingNumber]
109 115
 		]);
110 116
 		$result = GuzzleHttp\json_decode($res->getBody());
111
-		if($result->deleteTrack->result == 'KO') return $result->deleteTrack->error;
117
+		if($result->deleteTrack->result == 'KO') {
118
+			return $result->deleteTrack->error;
119
+		}
112 120
 		return true;
113 121
 	}
114 122
 
@@ -122,7 +130,9 @@  discard block
 block discarded – undo
122 130
 	{
123 131
 		$param_name = 'dateFrom';
124 132
 		$date_or_days ?: $date_or_days = config('qapla.orders.default_fromDate');
125
-		if(strtotime($date_or_days) === false) $param_name = 'days';
133
+		if(strtotime($date_or_days) === false) {
134
+			$param_name = 'days';
135
+		}
126 136
 
127 137
 		$client = new GuzzleHttp\Client();
128 138
 		$res = $client->get(config('qapla.url').'getOrders/', ['query' =>  [
@@ -130,7 +140,9 @@  discard block
 block discarded – undo
130 140
 			$param_name => $date_or_days]
131 141
 		]);
132 142
 		$result = GuzzleHttp\json_decode($res->getBody());
133
-		if($result->getOrders->result == 'KO') return $result->getOrders->error;
143
+		if($result->getOrders->result == 'KO') {
144
+			return $result->getOrders->error;
145
+		}
134 146
 		return $result->getOrders->orders;
135 147
 	}
136 148
 
@@ -153,7 +165,9 @@  discard block
 block discarded – undo
153 165
 			'body' => $json
154 166
 		]);
155 167
 		$result = GuzzleHttp\json_decode($res->getBody());
156
-		if($result->pushOrder->result == 'KO') return $result->pushOrder->error;
168
+		if($result->pushOrder->result == 'KO') {
169
+			return $result->pushOrder->error;
170
+		}
157 171
 		return true;
158 172
 	}
159 173
 
@@ -168,7 +182,9 @@  discard block
 block discarded – undo
168 182
 			'apiKey' => $this->privateApiKey]
169 183
 		]);
170 184
 		$result = GuzzleHttp\json_decode($res->getBody());
171
-		if($result->getCredits->result == 'KO') return $result->getCredits->error;
185
+		if($result->getCredits->result == 'KO') {
186
+			return $result->getCredits->error;
187
+		}
172 188
 		return $result->getCredits->credits;
173 189
 	}
174 190
 
@@ -186,7 +202,9 @@  discard block
 block discarded – undo
186 202
 			'country'   => $country ?: config('qapla.couriers.default_country')]
187 203
 		]);
188 204
 		$result = GuzzleHttp\json_decode($res->getBody());
189
-		if($result->getCouriers->result == 'KO') return $result->getCouriers->error;
205
+		if($result->getCouriers->result == 'KO') {
206
+			return $result->getCouriers->error;
207
+		}
190 208
 		return $result->getCouriers->courier;
191 209
 	}
192 210
 }
193 211
\ No newline at end of file
Please login to merge, or discard this patch.