Replace space with break line for each key element

@param array $aElements
@return array
487656
protected function setArrayToArrayKbr(array $aElements)
    {
        $aReturn = [];
        foreach ($aElements as $key => $value) {
            $aReturn[str_replace(' ', '<br/>', $key)] = $value;
        }
        return $aReturn;
    }
757274
private function getLine(array $fields): string
    {
        $fields = $this->quoteFields($fields);

        return $this->sEnclosure.implode($this->sEnclosure.$this->sDelimiter.$this->sEnclosure, $fields).$this->sEnclosure;
    }
770063
private function setTableCell($aElements, $features = null)
    {
        $sReturn = null;
        foreach ($aElements as $key => $value) {
            $value = str_replace(['& ', '\"', "\'"], ['&amp; ', '"', "'"], $value);
            if ((isset($features['grouping_cell'])) && ($features['grouping_cell'] == $key)) {
                // just skip
            } else {
                $sReturn .= '<td ';
                if (isset($features['column_formatting'][$key])) {
                    switch ($features['column_formatting'][$key]) {
                        case '@':
                            $sReturn .= 'style="text-align:left;">' . $value;
                            break;
                        case 'right':
                            $sReturn .= 'style="text-align:right;">' . $value;
                            break;
                        default:
                            $sReturn .= '???';
                            break;
                    }
                } else {
                    if (is_numeric($value)) {
                        $sReturn .= $this->setTableCellNumeric($key, $value, $features);
                    } else {
                        $outputet = false;
                        if ((strpos($value, '-') !== false) && (strlen($value) == 10)) {
                            if (preg_match("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $value, $regs)) {
                                $outputet = true;
                                $sReturn  .= 'style="text-align:right;width: 10px;">'
                                    . $regs[3] . '.' . $regs[2] . '.' . $regs[1];
                            }
                        }
                        if (!$outputet) {
                            $sReturn .= 'style="text-align:left;">' . $value;
                        }
                    }
                }
                $sReturn .= '</td>';
            }
        }
        return $sReturn;
    }
1277079
protected function replacePlaceholders($line, array $replace)
    {
        if (!$replace) {
            return $line;
        }

        foreach ($replace as $placeholder=>$replacement) {
            $line = str_replace($this->placeholderPrefix.$placeholder.$this->placeholderSuffix, $replacement, $line);
        }
        return $line;
    }
690317
protected function quoteFields(array $fields): array
    {
        if ('"' !== $this->sEnclosure) {
            return $fields;
        }

        return array_map(function ($element) {
            return \str_replace('"', '""', $element);
        }, $fields);
    }
189012
private function setTableHeader($aElements, $bHeadersBreaked)
    {
        $aTableHeader = $aElements;
        if ($bHeadersBreaked) {
            $aTableHeader = $this->setArrayToArrayKbr($aElements);
        }
        $sReturn = [];
        foreach (array_keys($aTableHeader) as $value) {
            $sReturn[] = $this->setStringIntoTag($value, 'th');
        }
        return implode('', $sReturn);
    }
391537
private function formatRows(array $rows) {
        foreach ($rows as $rowIndex => $row) {
            $type = $row['type'];
            $indent = $this->indent;
            $gutter = str_repeat(' ', $this->gutter);
            $verticalSeparator = $this->verticalSeparator;

            if ($type === '@section') {
                $indent = $this->sectionIndent;
            }

            foreach ($row['cols'] as $colIndex => $col) {
                if ($colIndex === 0) {
                    $col = str_repeat(' ', $indent) . $col;
                } else {
                    $col = $gutter . $verticalSeparator . $gutter . $col;
                }

                array_set($row['cols'], $colIndex, $col);
            }

            array_set($rows, $rowIndex, $row);
        }

        return $rows;
    }
652272
public function format( $sparql ) {
		$this->formattedParts = array();
		$this->indentationLevel = 0;
		$this->replacements = array();

		$regexHelper = new RegexHelper();
		$sparql = $regexHelper->escapeSequences( $sparql, $this->replacements );

		foreach ( $this->split( $sparql ) as $part ) {
			if ( !empty( $this->formattedParts ) ) {
				$this->before( $part );
			}

			$this->indentation( $part );
			$this->append( $part );
			$this->after( $part );
		}

		$this->trimEnd();
		$this->formattedParts[] = "\n";

		return strtr( implode( $this->formattedParts ), $this->replacements );
	}
55574
public function convert(ElementInterface $element)
    {
        $lines = explode("\n", $element->getValue());

        foreach ($lines as $key => $line)
        {
            $lines[$key] = trim($lines[$key]);
        }

        $lines = array_filter($lines);

        return "\n" . implode("\n", (array) $lines);
    }
1213856
private function calculateSelectOptionsSize($aElements, $aFeatures = [])
    {
        $selectSize = $this->calculateSelectOptionsSizeForced($aElements, $aFeatures);
        if ((in_array('include_null', $aFeatures)) && ($selectSize != '1')) {
            $selectSize++;
        }
        return $selectSize;
    }
380341
protected function _getExactMatch($aElements, $sValue)
    {
        foreach ($aElements as $oElement) {
            /** @var NodeElement $oElement */
            if (strcasecmp($oElement->getValue(), $sValue) == 0 || strcasecmp($oElement->getText(), $sValue) == 0) {
                return $oElement;
            }
        }

        return null;
    }
890840
private function getNestedMessage(NestedValidationException $e)
    {
        $message = [];
        $iterator = $e->getMessages();
        foreach ($iterator as $m) {
            $message[] = $m;
        }

        return implode(PHP_EOL, $message);
    }
1333347
private static function traverse($elems)
    {
        $result = [];

        foreach ($elems as $elem) {
            if ('{DAV:}property' !== $elem['name']) {
                continue;
            }

            $namespace = isset($elem['attributes']['namespace']) ?
                $elem['attributes']['namespace'] :
                'DAV:';

            $propName = '{'.$namespace.'}'.$elem['attributes']['name'];

            $value = null;
            if (is_array($elem['value'])) {
                $value = self::traverse($elem['value']);
            }

            $result[$propName] = $value;
        }

        return $result;
    }
34591
protected static function replaceOptionalSegments($regex)
    {
        preg_match(chr(1) . '\(/([a-z][a-zA-Z0-9_,]*)\)' . chr(1), $regex, $matches);

        if (!$matches) {
            return $regex;
        }

        $list = explode(',', $matches[1]);
        $head = '';

        if (substr($regex, 0, 2) === '(/') {
            $name = array_shift($list);
            $head = "/(\{{$name}\})?";
        }

        $tail = '';

        foreach ($list as $name) {
            $head .= "(/({$name})";
            $tail .= ')?';
        }

        $repl = $head . $tail;

        return str_replace($matches[0], $repl, $regex);
    }
1313571
public static function formatLines($lines, $prefixStart = 1)
    {
        $max = strlen((string)(count($lines) + $prefixStart));

        $prefixTemplate = "%{$max}d. ";
        $ret = '';
        foreach ($lines as $l => $line) {
            $ret .= sprintf($prefixTemplate, $prefixStart + $l) . $line . "\n";
        }
        return $ret;
    }
319472
public static function flattenExtended($array, $keyPrefix = '', $delimeter = '.', $trimAsNULL = TRUE)
	{
		$keyPrefix = trim($keyPrefix);
		$flat = [];
		foreach ($array as $key => $value) {
			$newKey = $keyPrefix . $key;
			if (static::is_array($value)) {
				$flat[Valid::digit($newKey) ? (int) $newKey : $newKey] = $value;
				$flat = static::merge($flat, static::flattenExtended($value, $newKey . $delimeter, $delimeter));
			} else {
				$flat[Valid::digit($newKey)	? (int) $newKey	: $newKey] = $trimAsNULL
					? Helpers_Text::trimAsNULL($value)
					: $value;
			}
		}

		return $flat;
	}
835314
public static function getNamespaceFromParts($parts) {
		$resultArray = [ ];
		if (! \is_array ( $parts )) {
			$parts = [ $parts ];
		}
		foreach ( $parts as $part ) {
			$resultArray = \array_merge ( $resultArray, \explode ( "\\", $part ) );
		}
		$resultArray = \array_diff ( $resultArray, [ "" ] );
		return \implode ( "\\", $resultArray );
	}