/** * @param OnlineShop_Framework_AbstractVoucherTokenType $configuration * @throws Exception */ public function __construct(OnlineShop_Framework_AbstractVoucherTokenType $configuration) { if ($configuration instanceof OnlineShop_Framework_AbstractVoucherTokenType) { $this->configuration = $configuration; $this->seriesId = $configuration->getObject()->getId(); $this->series = $configuration->getObject(); } else { throw new Exception("Invalid Configuration Class."); } }
/** * @param OnlineShop_Framework_AbstractVoucherTokenType $configuration * @return OnlineShop_Framework_VoucherService_ITokenManager * @throws OnlineShop_Framework_Exception_InvalidConfigException */ public function getTokenManager(OnlineShop_Framework_AbstractVoucherTokenType $configuration) { $type = $configuration->getType(); if (empty($this->tokenManagers[$type])) { $tokenManagerClass = $this->config->onlineshop->voucherservice->tokenmanagers->{$type}; if ($tokenManagerClass) { $tokenManager = new $tokenManagerClass->class($configuration); if (!$tokenManager instanceof OnlineShop_Framework_VoucherService_ITokenManager) { throw new OnlineShop_Framework_Exception_InvalidConfigException("Token Manager class " . $tokenManagerClass->class . " does not implement OnlineShop_Framework_VoucherService_ITokenManager."); } $this->tokenManagers[$type] = $tokenManager; } else { throw new OnlineShop_Framework_Exception_InvalidConfigException("Token Manager for " . $type . " not defined."); } } return $this->tokenManagers[$type]; }