Skip to content

Bugfix and magic

Latest
Compare
Choose a tag to compare
@morganestes morganestes released this 26 Aug 17:39
· 3 commits to master since this release
5e951bd

Change the way that pet data is generated and stored: instead of passing around the entire Pet everywhere, you can now just grab the API data from an array. Thanks to magic methods __get() and __set(), nothing changes on the front end much for accessing and saving data, just that it's now stored inside a private array.

This also introduces a new Pet method get_pet_details_array(), which takes and optional $key_case parameter to let you convert the data store on the fly to use snake_case keys or their original CamelCase names from the API's XML response.
For example, by default it'll return something like array( 'AnimalName' => 'Fred', ... ) but with 'snake_case' you'll get array( 'animal_name' => 'Fred', ... ). How is that useful? That's for you to determine.

Fixes issues with Pets not getting created correctly because the constructor was misnamed, except they were because it didn't do anything to begin with. 🤷