Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
ISOService | |
100.00% |
5 / 5 |
|
100.00% |
5 / 5 |
5 | |
100.00% |
1 / 1 |
getISO | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getISOs | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getPublicISOs | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
createISO | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
deleteISO | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Vultr\VultrPhp\Services\ISO; |
6 | |
7 | use Vultr\VultrPhp\Services\VultrService; |
8 | use Vultr\VultrPhp\Util\ListOptions; |
9 | |
10 | /** |
11 | * ISO service handler, for all iso endpoints. |
12 | * |
13 | * @see https://www.vultr.com/api/#tag/iso |
14 | */ |
15 | class ISOService extends VultrService |
16 | { |
17 | /** |
18 | * Get the ISO on the account. |
19 | * |
20 | * @param $iso_id - string |
21 | * @throws ISOException |
22 | * @return ISO |
23 | */ |
24 | public function getISO(string $iso_id) : ISO |
25 | { |
26 | return $this->getObject('iso/'.$iso_id, new ISO()); |
27 | } |
28 | |
29 | /** |
30 | * Get ISOS on the account. |
31 | * |
32 | * @param $options - ListOptions|null - Interact via reference. |
33 | * @throws ISOException |
34 | * @return ISO[] |
35 | */ |
36 | public function getISOs(?ListOptions &$options = null) : array |
37 | { |
38 | return $this->getListObjects('iso', new ISO(), $options); |
39 | } |
40 | |
41 | /** |
42 | * Get all publically available isos regardless of account. |
43 | * |
44 | * @param $options - ListOptions|null - Interact via reference. |
45 | * @throws ISOException |
46 | * @return PublicISO[] |
47 | */ |
48 | public function getPublicISOs(?ListOptions &$options = null) : array |
49 | { |
50 | return $this->getListObjects('iso-public', new PublicISO(), $options); |
51 | } |
52 | |
53 | /** |
54 | * Create an ISO from a url endpoint |
55 | * |
56 | * @param $url - string - Example: https://youramazing.com/url.iso |
57 | * @throws ISOException |
58 | * @return ISO |
59 | */ |
60 | public function createISO(string $url) : ISO |
61 | { |
62 | return $this->createObject('iso', new ISO(), ['url' => $url]); |
63 | } |
64 | |
65 | /** |
66 | * Delete an ISO on the account. |
67 | * |
68 | * @param $iso_id - string |
69 | * @throws ISOException |
70 | * @return void |
71 | */ |
72 | public function deleteISO(string $iso_id) : void |
73 | { |
74 | $this->deleteObject('iso/'.$iso_id, new ISO()); |
75 | } |
76 | } |