/**
  * Handle errors if occurred
  * (non-PHPdoc)
  * @see SofortLib::_handleErrors()
  */
 protected function _handleErrors()
 {
     if ($this->_apiVersion == 1) {
         return parent::_handleErrors();
     }
     if (!isset($this->_response['invoices']['invoice'][0])) {
         $tmp = $this->_response['invoices']['invoice'];
         unset($this->_response['invoices']['invoice']);
         $this->_response['invoices']['invoice'][0] = $tmp;
     }
     foreach ($this->_response['invoices']['invoice'] as $response) {
         //handle errors
         if (isset($response['errors']['error'])) {
             if (!isset($response['errors']['error'][0])) {
                 $tmp = $response['errors']['error'];
                 unset($response['errors']['error']);
                 $response['errors']['error'][0] = $tmp;
             }
             foreach ($response['errors']['error'] as $error) {
                 $this->errors['sr'][] = $this->_getErrorBlock($error);
             }
         }
         //handle warnings
         if (isset($response['warnings']['warning'])) {
             if (!isset($response['warnings']['warning'][0])) {
                 $tmp = $response['warnings']['warning'];
                 unset($response['warnings']['warning']);
                 $response['warnings']['warning'][0] = $tmp;
             }
             foreach ($response['warnings']['warning'] as $error) {
                 $this->warnings['sr'][] = $this->_getErrorBlock($error);
             }
         }
     }
 }