public function getRegions() { $apiRegions = $this->sendRequest('get', 'regions'); $regions = []; foreach ($apiRegions['regions'] as $region) { $regions[$region['slug']] = Region::create($region); } return $regions; }
public function __construct($provider, $data) { $this->provider = $provider; $this->id = $data['id']; $this->name = $data['name']; $this->region = Region::create($data['region']); $this->sizeId = $data['size_slug']; $this->image = Image::create($data['image']); $this->kernel = Kernel::create($data['kernel']); foreach ($data['networks']['v4'] as $ip) { $ip['version'] = '4'; $this->ipAddresses[] = IpAddress::create($ip); } foreach ($data['networks']['v6'] as $ip) { $ip['version'] = '6'; $this->ipAddresses[] = IpAddress::create($ip); } if ($data['status'] == 'active') { $this->isRunning = true; } if ($data['status'] == 'archive') { $this->isDeleted = true; } }