convertToPingppObject() публичный статический Метод

Converts a response from the Pingpp API to the corresponding PHP object.
public static convertToPingppObject ( stdObject $resp, array $opts ) : PingppObject | array
$resp stdObject The response from the Pingpp API.
$opts array
Результат Pingpp\PingppObject | array
Пример #1
0
 /**
  * Refreshes this object using the provided values.
  *
  * @param stdObject $values
  * @param array $opts
  * @param boolean $partial Defaults to false.
  */
 public function refreshFrom($values, $opts, $partial = false)
 {
     $this->_opts = $opts;
     // Wipe old state before setting new.  This is useful for e.g. updating a
     // customer, where there is no persistent card parameter.  Mark those values
     // which don't persist as transient
     if ($partial) {
         $removed = new Util\Set();
     } else {
         $removed = array_diff(array_keys($this->_values), array_keys(get_object_vars($values)));
     }
     foreach ($removed as $k) {
         if (self::$permanentAttributes->includes($k)) {
             continue;
         }
         unset($this->{$k});
     }
     foreach ($values as $k => $v) {
         if (self::$permanentAttributes->includes($k)) {
             continue;
         }
         if (self::$nestedUpdatableAttributes->includes($k) && is_object($v)) {
             $this->_values[$k] = AttachedObject::constructFrom($v, $opts);
         } else {
             $this->_values[$k] = Util\Util::convertToPingppObject($v, $opts);
         }
         $this->_transientValues->discard($k);
         $this->_unsavedValues->discard($k);
     }
 }