Esempio n. 1
0
 /**
  * @param array $data
  */
 public function __construct(array $data)
 {
     // extract root & check for status/error response
     if (is_array($data) && count($data) == 1) {
         // error or status response
         $key = key($data);
         $this->ok = $key != 'status';
         $data = reset($data);
     }
     parent::__construct($data);
 }
Esempio n. 2
0
 public function __construct(array $result)
 {
     // error responses hold status && message properties
     if (isset($result['status']) && isset($result['message'])) {
         $this->ok = false;
         $this->status = $result['status'];
         unset($result['status']);
         $this->message = $result['message'];
         unset($result['message']);
     }
     parent::__construct($result);
 }