/** * {@inheritdoc} */ public function get(ChannelInterface $channel) { $currencyCode = $this->storage->getData($this->provideKey($channel)); if (null === $currencyCode) { throw new CurrencyNotFoundException('No currency is set for current channel!'); } return $currencyCode; }
/** * {@inheritdoc} */ public function getStoredToken($clear = false) { if ($this->storage->hasData(self::STORE_KEY)) { $token = $this->storage->getData(self::STORE_KEY); if ($clear) { $this->storage->removeData(self::STORE_KEY); } return $token; } return; }
function it_throws_a_locale_not_found_exception_if_storage_does_not_have_locale_code_for_given_channel(StorageInterface $storage, ChannelInterface $channel) { $channel->getCode()->willReturn('web'); $storage->getData('_locale_web')->willReturn(null); $this->shouldThrow(LocaleNotFoundException::class)->during('get', [$channel]); }
/** * {@inheritdoc} */ public function setCurrencyCode($currencyCode) { return $this->storage->setData(self::STORAGE_KEY, $currencyCode); }
function its_current_locale_is_default_locale_by_default(StorageInterface $storage) { $storage->getData(Argument::cetera())->shouldBeCalled()->willReturn('pl_PL'); $this->getCurrentLocale()->shouldReturn('pl_PL'); }
/** * {@inheritdoc} */ public function setLocale($locale) { return $this->storage->setData(self::STORAGE_KEY, $locale); }
/** * {@inheritdoc} */ public function resetCurrentCartIdentifier() { $this->storage->removeData(self::STORAGE_KEY); }