Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
32 | public function get(): array |
||
33 | { |
||
34 | // No password has been set, return empty array. |
||
35 | if (!isset($this->password)) return []; |
||
36 | |||
37 | $url = $this->endpoint . 'pwnedpassword/' . $this->password; |
||
38 | $pwnedPasswords = $this->requestGet($url); |
||
39 | |||
40 | if (empty($pwnedPasswords)) { |
||
41 | return [ |
||
42 | 'code' => 200, |
||
43 | 'message' =>'Oh no — pwned! This password has previously appeared in a data breach and should never be used. If you\'ve ever used it anywhere before, change it immediately!' |
||
44 | ]; |
||
45 | } |
||
46 | return $pwnedPasswords; |
||
47 | } |
||
60 | } |