Esempio n. 1
0
 /**
  * Returns the specified PClass.
  *
  * @param int $id The PClass ID.
  *
  * @return KlarnaPClass
  */
 public function getPClass($id)
 {
     if (!is_numeric($id)) {
         throw new Klarna_InvalidTypeException('id', 'integer');
     }
     $this->_checkConfig();
     if (!$this->pclasses || !$this->pclasses instanceof PCStorage) {
         $this->pclasses = $this->getPCStorage();
         $this->pclasses->load($this->pcURI);
     }
     return $this->pclasses->getPClass(intval($id), $this->_eid, $this->_country);
 }
Esempio n. 2
0
 /**
  * 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());
     }
 }
Esempio n. 3
0
 /**
  * Returns the specified PClass.
  *
  * @param int $id The PClass ID.
  *
  * @return KlarnaPClass
  */
 public function getPClass($id)
 {
     if (!is_numeric($id)) {
         throw new Klarna_InvalidTypeException('id', 'integer');
     }
     if (!$this->config instanceof ArrayAccess) {
         throw new Klarna_IncompleteConfigurationException();
     }
     if (!$this->pclasses || !$this->pclasses instanceof PCStorage) {
         $this->pclasses = $this->getPCStorage();
         $this->pclasses->load($this->pcURI);
     }
     return $this->pclasses->getPClass(intval($id), $this->_eid, $this->_country);
 }