| @@ 43-50 (lines=8) @@ | ||
| 40 | */ |
|
| 41 | public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments) |
|
| 42 | { |
|
| 43 | if (! isset($arguments[0], $arguments[1])) { |
|
| 44 | throw new InvalidArgumentException( |
|
| 45 | esc_html__( |
|
| 46 | 'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class', |
|
| 47 | 'event_espresso' |
|
| 48 | ) |
|
| 49 | ); |
|
| 50 | } |
|
| 51 | $domain = LoaderFactory::getLoader()->getShared($domain_fqcn, $arguments); |
|
| 52 | if (! $domain instanceof $domain_fqcn && ! $domain instanceof DomainBase) { |
|
| 53 | throw new DomainException( |
|
| @@ 123-133 (lines=11) @@ | ||
| 120 | { |
|
| 121 | $this->getCountryCurrencyData(); |
|
| 122 | $CNT_ISO = $CNT_ISO !== null ? $CNT_ISO : $this->site_country_iso; |
|
| 123 | if(! isset($this->country_currencies_by_iso_code[ $CNT_ISO ])) { |
|
| 124 | throw new InvalidArgumentException( |
|
| 125 | sprintf( |
|
| 126 | esc_html__( |
|
| 127 | 'Valid country currency data could not be found for the "%1$s" country code;', |
|
| 128 | 'event_espresso' |
|
| 129 | ), |
|
| 130 | $CNT_ISO |
|
| 131 | ) |
|
| 132 | ); |
|
| 133 | } |
|
| 134 | return $this->createCurrencyFromCountryCurrency( |
|
| 135 | $this->country_currencies_by_iso_code[ $CNT_ISO ] |
|
| 136 | ); |
|
| @@ 154-164 (lines=11) @@ | ||
| 151 | public function createFromCode($code) |
|
| 152 | { |
|
| 153 | $this->getCountryCurrencyData(); |
|
| 154 | if (! isset($this->country_currencies_by_currency[ $code ])) { |
|
| 155 | throw new InvalidArgumentException( |
|
| 156 | sprintf( |
|
| 157 | esc_html__( |
|
| 158 | 'A valid currency could not be found for the "%1$s" currency code;', |
|
| 159 | 'event_espresso' |
|
| 160 | ), |
|
| 161 | $code |
|
| 162 | ) |
|
| 163 | ); |
|
| 164 | } |
|
| 165 | return $this->createCurrencyFromCountryCurrency( |
|
| 166 | $this->country_currencies_by_currency[ $code ] |
|
| 167 | ); |
|