/** * Returns the specified PClass. * * @param int $id The PClass ID. * @return KlarnaPClass */ public function getPClass($id) { try { if (!is_numeric($id)) { throw new Exception('Argument id is not an integer!', 50055); } else { if (!is_int($id)) { $id = intval($id); } } if (!$this->config instanceof ArrayAccess) { throw new Exception('Klarna instance not fully configured!', 50001); } if (!$this->pclasses || !$this->pclasses instanceof PCStorage) { $this->pclasses = $this->getPCStorage(); $this->pclasses->load($this->pcURI); } return $this->pclasses->getPClass($id, $this->eid, $this->country); } catch (Exception $e) { throw new KlarnaException('Error in ' . __METHOD__ . ': ' . $e->getMessage(), $e->getCode()); } }
/** * Set the pcStorage method used for this instance * * @param PCStorage $pcStorage PCStorage implementation * * @return void */ public function setPCStorage($pcStorage) { if (!$pcStorage instanceof PCStorage) { throw new Klarna_InvalidTypeException('pcStorage', 'PCStorage'); } $this->pcStorage = $pcStorage->getName(); $this->pclasses = $pcStorage; }