options = $options; } /** * Carrier ID. * * @param string $carrierId Carrier ID. * * @return static */ public static function createByCarrierId( string $carrierId ): self { $optionId = Checkout::CARRIER_PREFIX . $carrierId; $options = get_option( $optionId ); if ( empty( $options ) ) { $options = []; } return new self( $options ); } /** * Gets type of address validation. One of ['required', 'optional', 'none']. * * @return string */ public function getAddressValidation(): string { $none = 'none'; $value = $this->options['address_validation'] ?? $none; if ( $value ) { return $value; } return $none; } }