1 | <?php |
||
18 | class Volume extends AbstractResource implements Creatable, Listable, Updateable, Deletable, Retrievable, HasMetadata |
||
19 | { |
||
20 | use HasWaiterTrait; |
||
21 | |||
22 | /** @var string */ |
||
23 | public $id; |
||
24 | |||
25 | /** @var int */ |
||
26 | public $size; |
||
27 | |||
28 | /** @var string */ |
||
29 | public $status; |
||
30 | |||
31 | /** @var string */ |
||
32 | public $name; |
||
33 | |||
34 | /** @var array */ |
||
35 | public $attachments; |
||
36 | |||
37 | /** @var string */ |
||
38 | public $availabilityZone; |
||
39 | |||
40 | /** @var \DateTimeImmutable */ |
||
41 | public $createdAt; |
||
42 | |||
43 | /** @var string */ |
||
44 | public $description; |
||
45 | |||
46 | /** @var string */ |
||
47 | public $volumeTypeName; |
||
48 | |||
49 | /** @var string */ |
||
50 | public $snapshotId; |
||
51 | |||
52 | /** @var string */ |
||
53 | public $sourceVolumeId; |
||
54 | |||
55 | /** @var array */ |
||
56 | public $metadata = []; |
||
57 | |||
58 | protected $resourceKey = 'volume'; |
||
59 | protected $resourcesKey = 'volumes'; |
||
60 | protected $aliases = [ |
||
61 | 'availability_zone' => 'availabilityZone', |
||
62 | 'source_volid' => 'sourceVolumeId', |
||
63 | 'snapshot_id' => 'snapshotId', |
||
64 | 'created_at' => 'createdAt', |
||
65 | 'volume_type' => 'volumeTypeName', |
||
66 | ]; |
||
67 | |||
68 | 3 | public function populateFromResponse(ResponseInterface $response) |
|
74 | |||
75 | 1 | public function retrieve() |
|
76 | { |
||
77 | 1 | $response = $this->executeWithState($this->api->getVolume()); |
|
78 | 1 | return $this->populateFromResponse($response); |
|
|
|||
79 | } |
||
80 | |||
81 | /** |
||
82 | * @param array $userOptions {@see \OpenStack\BlockStorage\v2\Api::postVolumes} |
||
83 | * |
||
84 | * @return self |
||
85 | */ |
||
86 | 1 | public function create(array $userOptions) |
|
91 | |||
92 | /** |
||
93 | * @return self |
||
94 | */ |
||
95 | 1 | public function update() |
|
100 | |||
101 | 1 | public function delete() |
|
105 | |||
106 | 1 | public function getMetadata() |
|
112 | |||
113 | 1 | public function mergeMetadata(array $metadata) |
|
119 | |||
120 | 1 | public function resetMetadata(array $metadata) |
|
125 | |||
126 | 4 | public function parseMetadata(ResponseInterface $response) |
|
131 | } |
||
132 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.