Skip to content

Commit b1172bd

Browse files
committed
Cleaned up comments and docblocks.
1 parent b007a17 commit b1172bd

File tree

1 file changed

+45
-32
lines changed

1 file changed

+45
-32
lines changed

ToolkitApi/CW/cwclasses.php

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ public function setI5Error($errNum, $errCat = I5_CAT_PHP, $errMsg = '', $errDesc
226226

227227
/**
228228
* Return i5 error array for most recent action.
229+
*
229230
* @return array Error array for most recent action.
230231
*/
231232
public function getI5Error()
@@ -1053,18 +1054,45 @@ protected function findInputValueByName( $name, $inputArray )
10531054
*/
10541055
class DataDescriptionPcml extends DataDescription
10551056
{
1057+
// array of simple types, PCML to old toolkit. Used in singlePcmlToArray().
1058+
protected $_pcmlTypeMap = array('char' => I5_TYPE_CHAR,
1059+
'packed' => I5_TYPE_PACKED,
1060+
// 4 byte float
1061+
'float' => I5_TYPE_FLOAT,
1062+
// data structure
1063+
'struct' => I5_TYPE_STRUCT,
1064+
// omit INT from type map because we'll need program logic to determine if short or regular int.
1065+
'zoned' => I5_TYPE_ZONED,
1066+
// TODO not sure if byte really maps to binary. No one knows what BYTE really does
1067+
'byte' => I5_TYPE_BYTE,
1068+
);
1069+
1070+
// PCML usage mapping
1071+
protected $_pcmlInoutMap = array('input' => I5_IN,
1072+
'output' => I5_OUT,
1073+
'inputoutput' => I5_INOUT,
1074+
// inherit means inherit from parent element, and if no parent element, do INOUT.
1075+
// TODO implement "inherit" more precisely, checking parent element's usage.
1076+
'inherit' => I5_INOUT,
1077+
);
1078+
1079+
// maintain an array of pcml structures
1080+
protected $_pcmlStructs = array();
1081+
10561082
/**
10571083
* Constructor takes a PCML string and converts to an array-based old toolkit data description string.
1058-
* @param string $pcml The string of PCML
1059-
* @param ServiceToolkit $connection connection object for toolkit
1084+
*
1085+
* @param string $pcml The string of PCML
1086+
* @param ToolkitService $connection connection object for toolkit
1087+
* @throws \Exception
10601088
*/
10611089
public function __construct($pcml, ToolkitService $connection)
10621090
{
10631091
$this->setConnection($connection);
10641092

10651093
// Convert PCML from ANSI format (which old toolkit required) to UTF-8 (which SimpleXML requires).
10661094

1067-
$encoding = getConfigValue('system', 'encoding', 'ISO-8859-1'); // XML encoding
1095+
$encoding = $connection->getConfigValue('system', 'encoding', 'ISO-8859-1'); // XML encoding
10681096

10691097
/*
10701098
* Look for optionally set <?xml encoding attribute
@@ -1148,33 +1176,13 @@ public function __construct($pcml, ToolkitService $connection)
11481176
parent::__construct($pgmName, $dataDescriptionArray, $connection);
11491177
}
11501178

1151-
// array of simple types, PCML to old toolkit. Used in singlePcmlToArray().
1152-
protected $_pcmlTypeMap = array('char' => I5_TYPE_CHAR,
1153-
'packed' => I5_TYPE_PACKED,
1154-
// 4 byte float
1155-
'float' => I5_TYPE_FLOAT,
1156-
// data structure
1157-
'struct' => I5_TYPE_STRUCT,
1158-
// omit INT from type map because we'll need program logic to determine if short or regular int.
1159-
'zoned' => I5_TYPE_ZONED,
1160-
// TODO not sure if byte really maps to binary. No one knows what BYTE really does
1161-
'byte' => I5_TYPE_BYTE,
1162-
);
1163-
1164-
// PCML usage mapping
1165-
protected $_pcmlInoutMap = array('input' => I5_IN,
1166-
'output' => I5_OUT,
1167-
'inputoutput' => I5_INOUT,
1168-
// inherit means inherit from parent element, and if no parent element, do INOUT.
1169-
// TODO implement "inherit" more precisely, checking parent element's usage.
1170-
'inherit' => I5_INOUT,
1171-
);
1172-
1173-
// maintain an array of pcml structures
1174-
protected $_pcmlStructs = array();
1175-
1176-
// given a single ->data or ->struct element, return an array containing its contents as old toolkit-style data description.
1177-
public function singlePcmlToArray(SimpleXmlElement $dataElement)
1179+
/**
1180+
* given a single ->data or ->struct element, return an array containing its contents as old toolkit-style data description.
1181+
*
1182+
* @param \SimpleXmlElement $dataElement
1183+
* @return array
1184+
*/
1185+
public function singlePcmlToArray(\SimpleXmlElement $dataElement)
11781186
{
11791187
$tagName = $dataElement->getName();
11801188

@@ -1329,8 +1337,13 @@ public function singlePcmlToArray(SimpleXmlElement $dataElement)
13291337
return $element;
13301338
}
13311339

1332-
// given an XML object containing a PCML program definition, return an old toolkit style of data description array.
1333-
public function pcmlToArray(SimpleXMLElement $xmlObj)
1340+
/**
1341+
* given an XML object containing a PCML program definition, return an old toolkit style of data description array.
1342+
*
1343+
* @param \SimpleXMLElement $xmlObj
1344+
* @return array
1345+
*/
1346+
public function pcmlToArray(\SimpleXMLElement $xmlObj)
13341347
{
13351348
$dataDescription = array();
13361349

0 commit comments

Comments
 (0)