示例#1
0
 public static function convertToConektaObject($resp)
 {
     $types = self::$types;
     if (is_array($resp)) {
         if (isset($resp['object']) && is_string($resp['object']) && isset($types[$resp['object']])) {
             $class = $types[$resp['object']];
             $instance = new $class();
             $instance->loadFromArray($resp);
             return $instance;
         }
         if (isset($resp['street1']) || isset($resp['street2'])) {
             $class = '\\Conekta\\Address';
             $instance = new $class();
             $instance->loadFromArray($resp);
             return $instance;
         }
         if (current($resp)) {
             $instance = new Object();
             $instance->loadFromArray($resp);
             return $instance;
         }
         return new Object();
     }
     return $resp;
 }
示例#2
0
 protected static function _scpWhere($class, $params)
 {
     $instance = new Object();
     $requestor = new Requestor();
     $url = self::classUrl($class);
     $response = $requestor->request('get', $url, $params);
     $instance->loadFromArray($response);
     return $instance;
 }