Closed dmitrii-fediuk closed 1 year ago
Hi @dmitry-fedyuk
To clarify the design of the offsetGet()
method, it was implemented following by the ArrayAccess interface to allow user to access any value that retrieve from Omise API by an array directly.
i.e.
$charge = OmiseCharge::retrieve('chrg_id');
echo $charge['id']; // We want to have ArrayAccess::offsetGet(); to make this design.
So, for your request, to get the _values
array at the whole.
Currently, we are working on implement new Omise-PHP version, I would add this idea into the pipeline to consider add this feature in the future.
Btw, could you provide us more use case that you want to have function to access whole _values
array? that we could consider the implementation from the use case.
Thanks & Cheers :D Nam
I use the _values
array at the whole to log it (other words, to log the Omise's API responses).
The _values array is marked as private which might break some functionality. I would also be interested in seeing a functionality to get the whole answer array (object) via a public function. Right now I just serialize the whole object and put it in a text field in the database for later de-serialization.
You can use toArray()
function from the version 2.16.0.
https://github.com/omise/omise-php/blob/master/lib/omise/res/obj/OmiseObject.php#L128
We are closing this issue. Thank you for raising this.
There is a public
offsetGet()
method, but it returns only a particular element of the_values
array, and there is no way to get the_values
array at the whole.https://github.com/omise/omise-php/blob/v2.6.0/lib/omise/res/obj/OmiseObject.php#L5-L6