1 | <?php |
||||
2 | |||||
3 | namespace bSecure\UniversalCheckout\Helpers; |
||||
4 | |||||
5 | class Http |
||||
6 | { |
||||
7 | static $RequestHeaders = [ |
||||
8 | 'locale' => 'x-locale', |
||||
9 | 'currency' => 'x-currency', |
||||
10 | 'deviceType' => 'x-device-type', |
||||
11 | 'osVersion' => 'x-os-version', |
||||
12 | 'appVersion' => 'x-app-version', |
||||
13 | 'accessToken' => 'x-access-token' |
||||
14 | ]; |
||||
15 | |||||
16 | static $CurlContentTypes = [ |
||||
17 | 'JSON' => 'Application/json', |
||||
18 | 'MultiPartFormData' => 'Multipart/form-data' |
||||
19 | ]; |
||||
20 | |||||
21 | //in case of successful create, read, update, delete & any successful operation |
||||
22 | const SUCCESS = "success"; |
||||
23 | |||||
24 | //in case of operational or process failure |
||||
25 | const BAD_REQUEST = "bad_request"; |
||||
26 | |||||
27 | //in case of authentication failure, trying to access any protected route with expired or no API token |
||||
28 | const UNAUTHORISED = "unauthorised"; |
||||
29 | |||||
30 | //in case of validation failure |
||||
31 | const INPROCESSABLE = "inprocessable"; |
||||
32 | |||||
33 | static $Codes = [ |
||||
34 | self::SUCCESS => 200, |
||||
35 | self::BAD_REQUEST => 400, |
||||
36 | self::UNAUTHORISED => 401, |
||||
37 | self::INPROCESSABLE => 422 |
||||
38 | ]; |
||||
39 | |||||
40 | public static function getApiPossibleCodes() |
||||
41 | { |
||||
42 | return array_values(self::$Codes); |
||||
43 | } |
||||
44 | |||||
45 | public static function getIpDetails($ip) |
||||
0 ignored issues
–
show
|
|||||
46 | { |
||||
47 | return [ |
||||
48 | 'country_name' => 'Pakistan' |
||||
49 | ]; |
||||
50 | |||||
51 | $accessKey = env('IPSTACK_API_KEY'); |
||||
0 ignored issues
–
show
$accessKey = env('IPSTACK_API_KEY') is not reachable.
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed. Unreachable code is most often the result of function fx() {
try {
doSomething();
return true;
}
catch (\Exception $e) {
return false;
}
return false;
}
In the above example, the last ![]() The function
env was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
52 | $url = env('IPSTACK_URL') . $ip . '?access_key=' . $accessKey; |
||||
53 | return Helper::apiRequest('GET', $url); |
||||
54 | } |
||||
55 | } |
||||
56 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.