/**
* @param NodeInterface $contextNode The node for which the preceding node should be found
* @return NodeInterface The preceding node of $contextNode or NULL
*/
protected function getPrevForNode($contextNode)
{
$nodesInContext = $contextNode->getParent()->getChildNodes();
for ($i = 0; $i < count($nodesInContext) - 1; $i++) {
if ($nodesInContext[$i + 1] === $contextNode) {
return $nodesInContext[$i];
}
}
return null;
}