Example #1
0
 protected function result($data)
 {
     $data = $this->xmlToArray($data);
     if ($this->hasError($data)) {
         throw new FreteException($this->getErrorMessage($data), 0);
     }
     if (!$this->dataIsCollection($data)) {
         $this->result->fill($data);
         return $this->result;
     } else {
         return $this->makeCollection($data);
     }
 }
Example #2
0
 protected function result($data)
 {
     $data = $this->xmlToArray($data);
     # se tiver um erro, da a mensagem de erro
     if ($this->hasError($data)) {
         $exception = new FreteException($this->getErrorMessage($data));
         $exception->setErrorCode($this->getErrorCode($data));
         throw $exception;
     }
     if (!$this->dataIsCollection($data)) {
         $this->result->fill($data);
         return $this->result;
     } else {
         return $this->makeCollection($data);
     }
 }