}>}> */ private $countries; /** @var string */ private $source; /** @var string */ private $situation_on; /** * @param array}>}> $countries Keyed by WooCommerce country code. */ public function __construct( array $countries, string $source, string $situation_on ) { $this->countries = $countries; $this->source = $source; $this->situation_on = $situation_on; } /** * @param array $data */ public static function from_array( array $data ): RateSet { return new self( $data['countries'], (string) $data['source'], (string) $data['situation_on'] ); } /** * @return array */ public function to_array(): array { return array( 'source' => $this->source, 'situation_on' => $this->situation_on, 'countries' => $this->countries, ); } /** * @return array */ public function country_codes(): array { return array_keys( $this->countries ); } public function has( string $country ): bool { return isset( $this->countries[ $country ] ); } public function standard( string $country ): ?float { return $this->countries[ $country ]['standard'] ?? null; } /** * @return array}> */ public function reduced( string $country ): array { return $this->countries[ $country ]['reduced'] ?? array(); } public function source(): string { return $this->source; } public function situation_on(): string { return $this->situation_on; } }