Neos\Neos\Controller\Module\Management\WorkspacesController::postProcessDiffArray PHP Method

postProcessDiffArray() protected method

This method will check if content in the given diff array is either completely new or has been completely removed and wraps the respective part in or tags, because the Diff Renderer currently does not do that in these cases.
protected postProcessDiffArray ( array &$diffArray ) : void
$diffArray array
return void
    protected function postProcessDiffArray(array &$diffArray)
    {
        foreach ($diffArray as $index => $blocks) {
            foreach ($blocks as $blockIndex => $block) {
                $baseLines = trim(implode('', $block['base']['lines']), " \t\n\r ");
                $changedLines = trim(implode('', $block['changed']['lines']), " \t\n\r ");
                if ($baseLines === '') {
                    foreach ($block['changed']['lines'] as $lineIndex => $line) {
                        $diffArray[$index][$blockIndex]['changed']['lines'][$lineIndex] = '<ins>' . $line . '</ins>';
                    }
                }
                if ($changedLines === '') {
                    foreach ($block['base']['lines'] as $lineIndex => $line) {
                        $diffArray[$index][$blockIndex]['base']['lines'][$lineIndex] = '<del>' . $line . '</del>';
                    }
                }
            }
        }
    }