This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | abstract class AbstractRequest |
||
0 ignored issues
–
show
|
|||
4 | { |
||
0 ignored issues
–
show
|
|||
5 | const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26'; |
||
6 | const APIURL = 'https://api.go-tellm.com/api'; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
7 | |||
8 | const SECRET = 'hyTBJcvtpDLSgGUWjybbYUNKSSoVvMcfdjtjiQvf'; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
9 | const USERAGENT = 'Jodel/4.47.0 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )'; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
10 | const CLIENT_TYPE = 'android_4.47.0'; |
||
11 | |||
12 | private $accessToken = null; |
||
13 | private $payLoad; |
||
14 | public $expects = ''; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
15 | public $version = 'v2'; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
16 | public $hasPayload = FALSE; |
||
17 | |||
18 | public function execute() |
||
0 ignored issues
–
show
execute uses the super-global variable $_SERVER which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: // Bad
class Router
{
public function generate($path)
{
return $_SERVER['HOST'].$path;
}
}
// Better
class Router
{
private $host;
public function __construct($host)
{
$this->host = $host;
}
public function generate($path)
{
return $this->host.$path;
}
}
class Controller
{
public function myAction(Request $request)
{
// Instead of
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
// Better (assuming you use the Symfony2 request)
$page = $request->query->get('page', 1);
}
}
![]() |
|||
19 | { |
||
20 | $result = new \stdClass(); |
||
21 | |||
22 | $this->payLoad = $this->getPayload(); |
||
23 | $device_uid = ''; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
24 | if(isset($this->payLoad['device_uid'])) { |
||
25 | $device_uid = $this->payLoad['device_uid']; |
||
26 | } |
||
27 | |||
28 | |||
29 | $this->payLoad = json_encode($this->payLoad); |
||
30 | $header = $this->getSignHeaders(); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
31 | $url = $this->getFullUrl(); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 11 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
32 | |||
33 | if ($this->getAccessToken()) { |
||
34 | $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Bearer does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
35 | } |
||
36 | //Comment out to debug the Request: |
||
37 | |||
38 | /* |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
65% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
39 | printf("URL: "); |
||
40 | var_dump($url); |
||
41 | echo "<br />"; |
||
42 | printf("Header: "); |
||
43 | var_dump($header); |
||
44 | echo "<br />"; |
||
45 | printf("Payload: "); |
||
46 | var_dump($this->payLoad); |
||
47 | echo "<br />"; |
||
48 | */ |
||
49 | /* |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
55% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
50 | $options = array( |
||
51 | 'timeout' => 100, |
||
52 | 'connect_timeout' => 100, |
||
53 | 'proxy' => '186.103.169.165:8080', |
||
54 | );*/ |
||
55 | |||
56 | switch ($this->getMethod()) { |
||
57 | case 'POST': |
||
58 | $result = Requests::post($url, $header, $this->payLoad); |
||
0 ignored issues
–
show
$this->payLoad is of type string , but the function expects a array .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
59 | break; |
||
60 | case 'GET': |
||
61 | if($this->hasPayload) |
||
62 | { |
||
63 | $result = Requests::get($url, $header, $this->payLoad); |
||
0 ignored issues
–
show
$this->payLoad is of type string , but the function expects a array .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
64 | } |
||
65 | else |
||
66 | { |
||
67 | $result = Requests::get($url, $header); |
||
68 | } |
||
69 | break; |
||
70 | case 'PUT': |
||
71 | $result = Requests::put($url, $header, $this->payLoad); |
||
0 ignored issues
–
show
$this->payLoad is of type string , but the function expects a array .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
72 | break; |
||
73 | } |
||
74 | |||
75 | http_response_code($result->status_code); |
||
76 | |||
77 | switch ($result->status_code) { |
||
78 | case 200: |
||
79 | $result = json_decode($result->body, true); |
||
80 | break; |
||
81 | case 204: |
||
82 | $result = 'Success'; |
||
83 | http_response_code(200); |
||
84 | break; |
||
85 | View Code Duplication | case 400: |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
86 | $result = json_decode($result->body, true); |
||
87 | error_log('Error 400 - ' . print_r($result, true)); |
||
88 | break; |
||
89 | View Code Duplication | case 401: |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() The case body in a switch statement must start on the line following the statement.
According to the PSR-2, the body of a case statement must start on the line immediately following the case statement. switch ($expr) {
case "A":
doSomething(); //right
break;
case "B":
doSomethingElse(); //wrong
break;
} To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
90 | |||
91 | if($result == "Unauthorized") |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Unauthorized does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
92 | { |
||
93 | error_log("Error 401: Unauthorized"); |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Error 401: Unauthorized does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
94 | } |
||
95 | else |
||
96 | { |
||
97 | $result = json_decode($result->body, true); |
||
98 | |||
99 | if(is_array($result) && $result['error'] == 'length') |
||
0 ignored issues
–
show
This
if statement is empty and can be removed.
This check looks for the bodies of These if (rand(1, 6) > 3) {
//print "Check failed";
} else {
print "Check succeeded";
}
could be turned into if (rand(1, 6) <= 3) {
print "Check succeeded";
}
This is much more concise to read. ![]() |
|||
100 | { |
||
101 | |||
102 | } |
||
103 | else |
||
104 | { |
||
105 | error_log('Error 401 - ' . print_r($result, true)); |
||
106 | } |
||
107 | } |
||
108 | |||
109 | |||
110 | break; |
||
111 | View Code Duplication | case 404: |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() The case body in a switch statement must start on the line following the statement.
According to the PSR-2, the body of a case statement must start on the line immediately following the case statement. switch ($expr) {
case "A":
doSomething(); //right
break;
case "B":
doSomethingElse(); //wrong
break;
} To learn more about the PSR-2 coding standard, please refer to the PHP-Fig. ![]() |
|||
112 | |||
113 | |||
114 | error_log('Error 404 - ' . print_r($result, true)); |
||
115 | $result = json_decode($result->body, true); |
||
116 | |||
117 | if(array_key_exists('error', $result) && $result['error'] == 'post_blocked') |
||
118 | { |
||
119 | header('HTTP/1.0 404 Not Found'); |
||
120 | include('error-pages/404.php'); |
||
121 | exit(); |
||
0 ignored issues
–
show
The method
execute() contains an exit expression.
An exit expression should only be used in rare cases. For example, if you write a short command line script. In most cases however, using an ![]() |
|||
122 | } |
||
123 | |||
124 | break; |
||
125 | View Code Duplication | case 477: |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
126 | $result = json_decode($result->body, true); |
||
127 | error_log('Error 477 - ' . print_r($result, true)); |
||
128 | break; |
||
129 | View Code Duplication | case 429: |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
130 | error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, true), true)); |
||
131 | exit("Error 429: Too Many Requests"); |
||
0 ignored issues
–
show
The method
execute() contains an exit expression.
An exit expression should only be used in rare cases. For example, if you write a short command line script. In most cases however, using an ![]() Coding Style
Comprehensibility
introduced
by
The string literal
Error 429: Too Many Requests does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
132 | break; |
||
0 ignored issues
–
show
break; does not seem to be 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 ![]() |
|||
133 | case 403: |
||
134 | error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, true), true)); |
||
135 | $result = json_decode($result->body, true); |
||
136 | break; |
||
137 | case 502: |
||
138 | error_log('Error 502 - ' . print_r($result, true)); |
||
139 | $result = json_decode($result->body, true); |
||
140 | header('location:'.$_SERVER['PHP_SELF']); |
||
141 | break; |
||
142 | View Code Duplication | case 503: |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
143 | error_log('Error 503 - ' . print_r($result, true)); |
||
144 | $result = json_decode($result->body, true); |
||
145 | |||
146 | if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable') |
||
147 | { |
||
148 | header('location:'.$_SERVER['PHP_SELF']); |
||
149 | } |
||
150 | break; |
||
151 | default: |
||
152 | error_log('Error '.$result->status_code.' - unknown error'); |
||
153 | $result = json_decode($result->body, true); |
||
154 | } |
||
155 | |||
156 | //important for account refresh |
||
157 | if($device_uid != '') |
||
158 | { |
||
159 | $result[0] = $result; |
||
160 | $result[1] = $device_uid; |
||
161 | } |
||
162 | |||
163 | |||
164 | /* |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
67% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
165 | var_dump($result); |
||
166 | */ |
||
167 | |||
168 | return $result; |
||
169 | } |
||
170 | abstract function getPayload(); |
||
0 ignored issues
–
show
For interfaces and abstract methods it is generally a good practice to add a
@return annotation even if it is just @return void or @return null , so that implementors know what to do in the overridden method.
For interface and abstract methods, it is impossible to infer the return type
from the immediate code. In these cases, it is generally advisible to explicitly
annotate these methods with a ![]() |
|||
171 | /** |
||
172 | * Gets Sign headers |
||
173 | * @return array headers |
||
0 ignored issues
–
show
|
|||
174 | */ |
||
175 | private function getSignHeaders() |
||
176 | { |
||
177 | if($this->getAccessToken() == null) { |
||
178 | $payload_accessToken = ""; |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
179 | } |
||
180 | else { |
||
181 | $payload_accessToken = $this->getAccessToken(); |
||
182 | } |
||
183 | |||
184 | |||
185 | $headers = array( |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 20 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
186 | "Connection" => "keep-alive", |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Connection does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
keep-alive does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
187 | "Accept-Encoding" => "gzip", |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Accept-Encoding does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
gzip does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
188 | "Content-Type" => "application/json; charset=UTF-8", |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
Content-Type does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
application/json; charset=UTF-8 does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
189 | "User-Agent" => self::USERAGENT |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
User-Agent does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
190 | ); |
||
191 | $timestamp = new DateTime(); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 18 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
192 | $timestamp = $timestamp->format(DateTime::ATOM); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 18 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
193 | $timestamp = substr($timestamp, 0, -6); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 18 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
194 | $timestamp .= "Z"; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 17 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
Z does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
195 | $urlParts = parse_url($this->getFullUrl()); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 19 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
196 | $url2 = ""; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 23 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
197 | $req = [$this->getMethod(), |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 24 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
198 | $urlParts['host'], |
||
199 | "443", |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
443 does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
200 | $urlParts['path'], |
||
201 | $payload_accessToken, |
||
202 | $timestamp, |
||
203 | $url2, |
||
204 | $this->payLoad]; |
||
205 | $reqString = implode("%", $req); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 18 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
% does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
206 | $secret = self::SECRET; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 21 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
207 | $signature = hash_hmac('sha1', $reqString, $secret); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 18 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
208 | $signature = strtoupper($signature); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 18 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
209 | $headers['X-Authorization'] = 'HMAC ' . $signature; |
||
210 | $headers['X-Client-Type'] = self::CLIENT_TYPE; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
211 | $headers['X-Timestamp'] = $timestamp; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
212 | $headers['X-Api-Version'] = '0.2'; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
213 | return $headers; |
||
214 | } |
||
215 | private function getFullUrl() |
||
216 | { |
||
217 | return self::APIURL . $this->getApiEndPoint(); |
||
218 | } |
||
219 | abstract function getApiEndPoint(); |
||
0 ignored issues
–
show
For interfaces and abstract methods it is generally a good practice to add a
@return annotation even if it is just @return void or @return null , so that implementors know what to do in the overridden method.
For interface and abstract methods, it is impossible to infer the return type
from the immediate code. In these cases, it is generally advisible to explicitly
annotate these methods with a ![]() |
|||
220 | abstract function getMethod(); |
||
0 ignored issues
–
show
For interfaces and abstract methods it is generally a good practice to add a
@return annotation even if it is just @return void or @return null , so that implementors know what to do in the overridden method.
For interface and abstract methods, it is impossible to infer the return type
from the immediate code. In these cases, it is generally advisible to explicitly
annotate these methods with a ![]() |
|||
221 | /** |
||
222 | * @return string |
||
223 | */ |
||
224 | private function getAccessToken() |
||
225 | { |
||
226 | return $this->accessToken; |
||
227 | } |
||
228 | /** |
||
229 | * @param string $accessToken |
||
230 | */ |
||
231 | public function setAccessToken($accessToken) |
||
232 | { |
||
233 | $this->accessToken = $accessToken; |
||
234 | } |
||
235 | } |
||
0 ignored issues
–
show
|
|||
236 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.