| 1 | <?php |
||
| 18 | class ClientHandshake implements HandshakeInterface |
||
| 19 | {
|
||
| 20 | 2 | public function sign($request, Response $response = null) |
|
| 21 | {
|
||
| 22 | 2 | if ($response !== null) {
|
|
| 23 | 1 | throw new RuntimeException('You cannot give a Response as the client should create the key.');
|
|
| 24 | } |
||
| 25 | |||
| 26 | 1 | if (!$request instanceof Request) {
|
|
| 27 | throw new RuntimeException(sprintf('Expected request at first argument but got %s', gettype($request)));
|
||
| 28 | } |
||
| 29 | |||
| 30 | 1 | $key = ''; |
|
| 31 | 1 | for ($i = 0; $i < 16; $i++) {
|
|
| 32 | 1 | $key .= chr(mt_rand(0,255)); |
|
| 33 | } |
||
| 34 | |||
| 35 | 1 | $key = base64_encode($key); |
|
| 36 | |||
| 37 | 1 | $request->setKey($key); |
|
| 38 | |||
| 39 | 1 | return $key; |
|
| 40 | } |
||
| 41 | |||
| 42 | public function verify($request) |
||
| 46 | |||
| 47 | public function createRequest(string $uri) |
||
| 51 | } |
||
| 52 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.