Region.php 780 Bytes
Newer Older
1 2 3 4 5 6 7 8
<?hh // strict

namespace _91Carriage\Droplets;

use ConstMapAccess;
use InvalidArgumentException as IAE;

class Region extends Object {
Simon Welsh's avatar
Simon Welsh committed
9 10 11 12 13
	public string $slug;
	public string $name;
	public Set<string> $sizes;
	public bool $available;
	public Set<string> $features;
14 15

	public function __construct(ConstMapAccess<string, mixed> $data) {
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
		$this->slug = nullthrows(static::_toString($data, 'slug'));
		$this->name = nullthrows(static::_toString($data, 'name'));
		$this->sizes = nullthrows(static::_toSet(
			$data,
			'sizes',
			class_meth(static::class, '_toString'),
		));
		$this->available = nullthrows(static::_toBool(
			$data,
			'available',
		));
		$this->features = nullthrows(static::_toSet(
			$data,
			'features',
			class_meth(static::class, '_toString'),
		));
32 33
	}
}