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