public function getInnerText($e, $normalizeSpaces = true, $flattenLines = false) { if (null === $e || !isset($e->textContent) || $e->textContent === '') { return ''; } $textContent = trim($e->textContent); if ($flattenLines) { $textContent = mb_ereg_replace('(?:[\\r\\n](?:\\s| )*)+', '', $textContent); } elseif ($normalizeSpaces) { $textContent = mb_ereg_replace('\\s\\s+', ' ', $textContent); } return $textContent; }