/** * @todo move to better place * * @param type $service * @param type $account */ public function addServiceToAccount($service, $account) { if ($service instanceof VirtualPackage) { $transaction = new Transaction($account); $transaction->enableInvoice(); $transaction->enableLogging(); $transaction->setAmount($service->getCost()); $transaction->setVirtualAmount($service->getAmount()); $transaction->setInformation($service->getDescription()); $transaction->disableExchange(); $this->bank->deposit($transaction); } elseif ($service instanceof SubscriptionService) { $this->sa->add($service, $account); } else { throw new BankException("Unsupported service object class"); } }