Total Complexity | 4 |
Total Lines | 42 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
15 | class Breaches extends Pwned |
||
16 | { |
||
17 | private $domain; |
||
18 | |||
19 | /** |
||
20 | * Breaches constructor. |
||
21 | */ |
||
22 | public function __construct() |
||
23 | { |
||
24 | parent::__construct(); |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * This function gets all breaches. |
||
29 | * @return array |
||
30 | */ |
||
31 | public function get(): array |
||
32 | { |
||
33 | $filters = []; |
||
34 | $url = $this->endpoint . 'breaches/'; |
||
35 | |||
36 | // Filter domain, if available. |
||
37 | if (isset($this->domain)) { |
||
38 | $filters['domain'] = $this->domain; |
||
39 | } |
||
40 | |||
41 | $url = $this->setFilters($url, $filters); |
||
42 | $breaches = $this->requestGet($url); |
||
43 | |||
44 | return $breaches; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Sets the domain filter. Filter the results only to the domain specified. |
||
49 | * |
||
50 | * @param string $domain |
||
51 | * @return $this |
||
52 | */ |
||
53 | public function setDomain(string $domain) |
||
57 | } |
||
58 | } |