private function collectNodes()
{
$nlNodes = $this->_xp->query('//ns:node');
if ($nlNodes->length == 0) {
throw new WorkflowException("no node could be found in this workflow");
}
$result = [];
for ($i = 0; $i < $nlNodes->length; $i++) {
$currentNode = $nlNodes->item($i);
$nl2 = $this->_xp->query("@id", $currentNode);
if ($nl2->length != 1) {
throw new WorkflowException("failed to extract yed node id");
}
// yEd node Id
$yNodeId = trim($nl2->item(0)->value);
// extract mandatory properties ////////////////////////////////////////////////////////////
$nl2 = $this->_xp->query('ns:data[@key="' . $this->_yedProperties['n-graphics'] . '"]/*/y:NodeLabel', $currentNode);
if ($nl2->length != 1) {
continue;
}
$result[$yNodeId] = [];
$result[$yNodeId]['id'] = trim($nl2->item(0)->nodeValue);
// extract custom properties /////////////////////////////////////////////////////////////////
if (isset($this->_yedProperties['n-label'])) {
$nl2 = $this->_xp->query('ns:data[@key="' . $this->_yedProperties['n-label'] . '"]', $currentNode);
if ($nl2->length == 1) {
$result[$yNodeId]['label'] = trim($nl2->item(0)->nodeValue);
}
}
$nl2 = $this->_xp->query('ns:data[@key="' . $this->_yedProperties['n-graphics'] . '"]/*/y:Fill/@color', $currentNode);
if ($nl2->length == 1) {
$result[$yNodeId]['background-color'] = trim($nl2->item(0)->nodeValue);
}
$nl2 = $this->_xp->query('ns:data[@key="' . $this->_yedProperties['n-graphics'] . '"]/*/y:NodeLabel/@textColor', $currentNode);
if ($nl2->length == 1) {
$result[$yNodeId]['color'] = trim($nl2->item(0)->nodeValue);
}
}
return $result;
}