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

Commit 72d3bef

Browse files
committed
Changed the makeCall function to do a little more work. Now it actually runs the xmlAttributesToArray function before it returns.
1 parent 0ef70fc commit 72d3bef

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Machine/MachineAbstract.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ protected function getBaseUrl()
8686
*
8787
* @return array An associated array of XML attributes.
8888
*/
89-
protected function xmlAttributesToArray($xmlNodes)
89+
protected function xmlAttributesToArray($xml)
9090
{
9191
$array = array();
9292
$i= 0;;
93-
foreach($xmlNodes as $xmlNode) {
94-
foreach($xmlNode->attributes() as $key => $value) {
93+
foreach($xml as $node) {
94+
foreach($node->attributes() as $key => $value) {
9595
// For abstraction, everything is casted to string. It is the
9696
// responsibility of the calling method to handle typing.
9797
$array[$i][$key] = (string) $value[0];
@@ -120,7 +120,9 @@ protected function makeCall($url)
120120
$response = curl_exec($ch);
121121

122122
curl_close($ch);
123-
124-
return simplexml_load_string($response);
123+
124+
$xml = simplexml_load_string($response);
125+
126+
return $this->xmlAttributesToArray($xml);
125127
}
126128
}

0 commit comments

Comments
 (0)