Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Commit

Permalink
Changed the makeCall function to do a little more work. Now it actual…
Browse files Browse the repository at this point in the history
…ly runs the xmlAttributesToArray function before it returns.
  • Loading branch information
nickbart committed Dec 16, 2012
1 parent 0ef70fc commit 72d3bef
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Machine/MachineAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ protected function getBaseUrl()
*
* @return array An associated array of XML attributes.
*/
protected function xmlAttributesToArray($xmlNodes)
protected function xmlAttributesToArray($xml)
{
$array = array();
$i= 0;;
foreach($xmlNodes as $xmlNode) {
foreach($xmlNode->attributes() as $key => $value) {
foreach($xml as $node) {
foreach($node->attributes() as $key => $value) {
// For abstraction, everything is casted to string. It is the
// responsibility of the calling method to handle typing.
$array[$i][$key] = (string) $value[0];
Expand Down Expand Up @@ -120,7 +120,9 @@ protected function makeCall($url)
$response = curl_exec($ch);

curl_close($ch);

return simplexml_load_string($response);

$xml = simplexml_load_string($response);

return $this->xmlAttributesToArray($xml);
}
}

0 comments on commit 72d3bef

Please sign in to comment.