Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 3695bbe

Browse files
author
Charles Ma
committed
BUG: refs #301 Fixed style
1 parent 4c964cf commit 3695bbe

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

core/controllers/components/UtilityComponent.php

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,56 +15,56 @@ class UtilityComponent extends AppComponent
1515
{
1616

1717
/**
18-
* The main function for converting to an XML document.
19-
* Pass in a multi dimensional array and this recrusively loops through and builds up an XML document.
20-
*
21-
* @param array $data
22-
* @param string $rootNodeName - what you want the root node to be - defaultsto data.
23-
* @param SimpleXMLElement $xml - should only be used recursively
24-
* @return string XML
25-
*/
26-
public function toXml($data, $rootNodeName = 'data', $xml=null)
18+
* The main function for converting to an XML document.
19+
* Pass in a multi dimensional array and this recrusively loops through and builds up an XML document.
20+
*
21+
* @param array $data
22+
* @param string $rootNodeName - what you want the root node to be - defaultsto data.
23+
* @param SimpleXMLElement $xml - should only be used recursively
24+
* @return string XML
25+
*/
26+
public function toXml($data, $rootNodeName = 'data', $xml = null)
2727
{
28-
// turn off compatibility mode as simple xml throws a wobbly if you don't.
29-
if(ini_get('zend.ze1_compatibility_mode') == 1)
28+
// turn off compatibility mode as simple xml throws a wobbly if you don't.
29+
if(ini_get('zend.ze1_compatibility_mode') == 1)
3030
{
31-
ini_set ('zend.ze1_compatibility_mode', 0);
31+
ini_set('zend.ze1_compatibility_mode', 0);
3232
}
3333

34-
if ($xml == null)
34+
if($xml == null)
3535
{
36-
$xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><$rootNodeName />");
36+
$xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><".$rootNodeName." />");
3737
}
3838

39-
// loop through the data passed in.
40-
foreach($data as $key => $value)
39+
// loop through the data passed in.
40+
foreach($data as $key => $value)
4141
{
42-
// no numeric keys in our xml please!
43-
if(is_numeric($key))
42+
// no numeric keys in our xml please!
43+
if(is_numeric($key))
4444
{
45-
// make string key...
46-
$key = "unknownNode_". (string) $key;
45+
// make string key...
46+
$key = "unknownNode_". (string) $key;
4747
}
4848

49-
// replace anything not alpha numeric
50-
$key = preg_replace('/[^a-z]/i', '', $key);
49+
// replace anything not alpha numeric
50+
$key = preg_replace('/[^a-z]/i', '', $key);
5151

52-
// if there is another array found recrusively call this function
53-
if(is_array($value))
52+
// if there is another array found recrusively call this function
53+
if(is_array($value))
5454
{
55-
$node = $xml->addChild($key);
56-
// recrusive call.
57-
$this->toXml($value, $rootNodeName, $node);
55+
$node = $xml->addChild($key);
56+
// recrusive call.
57+
$this->toXml($value, $rootNodeName, $node);
5858
}
59-
else
59+
else
6060
{
61-
// add single node.
61+
// add single node.
6262
$value = htmlentities($value);
63-
$xml->addChild($key,$value);
63+
$xml->addChild($key, $value);
6464
}
6565
}
66-
// pass back as string. or simple xml object if you want!
67-
return $xml->asXML();
66+
// pass back as string. or simple xml object if you want!
67+
return $xml->asXML();
6868
}
6969
/** Get all the modules */
7070
public function getAllModules()

modules/remoteprocessing/controllers/components/JobComponent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function computeLogs($job, $logs, $params)
105105
$xml .= "<![CDATA[".JsonComponent::encode($params)."]]>";
106106
$xml .= "</JobParameters>\n";
107107
$logs = explode("-COMMAND\r", $logs);
108-
if(count($logs)<2)
108+
if(count($logs) < 2)
109109
{
110110
return "";
111111
}
@@ -185,7 +185,7 @@ public function convertXmlREsults($xml)
185185
$tmp['command'] = trim((string) $process->Command);
186186
$tmp['stderr'] = trim((string) $process->Error);
187187
$tmp['stdout'] = trim((string) $process->Output);
188-
$tmp['xmlStdout'] = simplexml_load_string($tmp['stdout'], 'SimpleXMLElement', LIBXML_NOCDATA);;
188+
$tmp['xmlStdout'] = simplexml_load_string($tmp['stdout'], 'SimpleXMLElement', LIBXML_NOCDATA);
189189
$tmp['time'] = (float) trim(str_replace("s", "", (string) $process->ExecutionTime)); //convert in milliseconds
190190
$tmp['output'] = array();
191191
$tmp['parameters'] = array();

0 commit comments

Comments
 (0)