Search code examples
phpsdkeway

How can I get protected values of an object of eway response?


When I try to get Customer info by TokenCustomerID in my eway sdk.It return a object .Please find object screenshot.

I want to access data from this object, but how ? enter image description here

Thanks in advance.


Solution

  • The eWAY PHP SDK uses traits to implement many features, including the get/set functionality - these can be found in HasAttributesTrait

    This means you can access the properties directly even though they are labelled as protected when you dump the object:

    $response = $client->queryCustomer(917758625852);
    $tokenCustomerID = $response->Customers[0]->TokenCustomerID;