Conditions | 4 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
32 | public function getSecretKey($date) |
||
|
|||
33 | { |
||
34 | if (is_string($date) && strlen($date) >= 8) { |
||
35 | $date = substr($date, 0, 8); |
||
36 | |||
37 | if (!empty($_SESSION[$date])) { |
||
38 | return $_SESSION[$date]; |
||
39 | } |
||
40 | } |
||
41 | |||
42 | return $_SESSION[$date] = $this->client->getResponse($this->getUrl(__FUNCTION__), ['date' => $date])['data']; |
||
43 | } |
||
44 | |||
85 | } |
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: