You are here

protected function Mollie_API_Resource_Base::copy in Commerce Mollie 7

Copy the results received from the API into the PHP objects that we use.

Parameters

object $api_result:

object $object:

Return value

object

4 calls to Mollie_API_Resource_Base::copy()
Mollie_API_Resource_Base::rest_create in Mollie/API/Resource/Base.php
Mollie_API_Resource_Base::rest_list in Mollie/API/Resource/Base.php
Get a collection of objects from the REST API.
Mollie_API_Resource_Base::rest_read in Mollie/API/Resource/Base.php
Retrieves a single object from the REST API.
Mollie_API_Resource_Payments::refund in Mollie/API/Resource/Payments.php

File

Mollie/API/Resource/Base.php, line 127

Class

Mollie_API_Resource_Base
Copyright (c) 2013, Mollie B.V. All rights reserved.

Code

protected function copy($api_result, $object) {
  foreach ($api_result as $property => $value) {
    if (property_exists(get_class($object), $property)) {
      $object->{$property} = $value;
    }
  }
  return $object;
}