| Conditions | 1 |
| Paths | 1 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function sign(string $url): string |
||
| 27 | { |
||
| 28 | $segments = parse_url($url); |
||
| 29 | $urlPartToSign = $segments['path'].'?'.$segments['query']; |
||
| 30 | // Decode the private key into its binary format |
||
| 31 | $decodedKey = base64_decode(str_replace(array('-', '_'), array('+', '/'), $this->secretCode)); |
||
| 32 | // Create a signature using the private key and the URL-encoded |
||
| 33 | // string using HMAC SHA1. This signature will be binary. |
||
| 34 | $signature = hash_hmac('sha1', $urlPartToSign, $decodedKey, true); |
||
| 35 | $encodedSignature = str_replace(array('+', '/'), array('-', '_'), base64_encode($signature)); |
||
| 36 | return sprintf('%s&signature=%s', $url, $encodedSignature); |
||
| 37 | } |
||
| 38 | |||
| 50 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.