Return a string of the form "parent - page" or "grandparent - parent - page" using page titles

@param int $level The maximum amount of levels to traverse.
@param string $separator Seperating string
@return string The resulting string
483248
public function NestedTitle($level = 2, $separator = " - ")
    {
        $item = $this;
        $parts = [];
        while ($item && $level > 0) {
            $parts[] = $item->Title;
            $item = $item->getParent();
            $level--;
        }
        return implode($separator, array_reverse($parts));
    }
1228781
final public static function logLevelToPsr($level)
    {
        $origLevel = $level;

        if (is_numeric($level)) {
            $level = intval($level);
            if (isset(self::$psrLevels[$level])) {
                return self::$psrLevels[$level];
            }
        } elseif (is_string($level)) {
            $level = strtolower($level);
            if (in_array($level, self::$psrLevels)) {
                return $level;
            }
        }

        throw new RuntimeException(
            sprintf("Cannot convert log-level '%s' to psr-style", $origLevel)
        );
    }
1348459
public function text($formatter)
    {
        if ($this->_parent) {
            if ($this->_parent->isClass()) {
                $superClassname = $this->_parent->superclass();
                if ($superClassname) {
                    $superClass =& $this->_root->classNamed($superClassname);
                    if ($superClass) {
                        $textTag = $superClass->tags('@text');
                        if ($textTag) {
                            $text = $textTag->text($formatter);
                            if ($text) {
                                return $text;
                            }
                        }
                    }
                }
                $interfaces = $this->_parent->interfaces();
                foreach ($interfaces as $interface) {
                    $textTag = $interface->tags('@text');
                    if ($textTag) {
                        $text = $textTag->text($formatter);
                        if ($text) {
                            return $text;
                        }
                    }
                }
            } elseif ($this->_parent->isConstructor() || $this->_parent->isMethod()) {
                $parentClass =& $this->_parent->containingClass();
                if ($parentClass) {
                    $superClassname = $parentClass->superclass();
                    if ($superClassname) {
                        $superClass =& $this->_root->classNamed($superClassname);
                        if ($superClass) {
                            $superMethod =& $superClass->methodNamed($this->_parent->name());
                            if ($superMethod) {
                                $textTag = $superMethod->tags('@text');
                                if ($textTag) {
                                    $text = $textTag->text($formatter);
                                    if ($text) {
                                        return $text;
                                    }
                                }
                            }
                        }
                    }
                    $interfaces = $parentClass->interfaces();
                    foreach ($interfaces as $interface) {
                        $superMethod =& $interface->methodNamed($this->_parent->name());
                        if ($superMethod) {
                            $textTag = $superMethod->tags('@text');
                            if ($textTag) {
                                $text = $textTag->text($formatter);
                                if ($text) {
                                    return $text;
                                }
                            }
                        }
                    }
                }
            } elseif ($this->_parent->isField()) {
                $parentClass =& $this->_parent->containingClass();
                if ($parentClass) {
                    $superClassname = $parentClass->superclass();
                    if ($superClassname) {
                        $superClass =& $this->_root->classNamed($superClassname);
                        if ($superClass) {
                            $superField =& $superClass->fieldNamed($this->_parent->name());
                            if ($superField) {
                                $textTag = $superField->tags('@text');
                                if ($textTag) {
                                    $text = $textTag->text($formatter);
                                    if ($text) {
                                        return $text;
                                    }
                                }
                            }
                        }
                    }
                    $interfaces = $parentClass->interfaces();
                    foreach ($interfaces as $interface) {
                        $superField =& $interface->fieldNamed($this->_parent->name());
                        if ($superField) {
                            $textTag = $superField->tags('@text');
                            if ($textTag) {
                                $text = $textTag->text($formatter);
                                if ($text) {
                                    return $text;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
732063
public function getGeoLocationAsString(string $separator = ';'): string
    {
        return number_format($this->latitude, 6) . $separator . number_format($this->longitude, 6);
    }
259595
public static function psrToPhpLevel($level, $default = LOG_DEBUG): string
    {
        $psrLevel = array_search($level, self::$psrLogLevels);

        return $psrLevel ?: $default;
    }
51089
private function renderTitleFirst($separator)
    {
        $output   = [];
        $output[] = $this->getTitleOnly();

        if ($this->hasSiteName()) {
            $output[] = $separator;
            $output[] = $this->getSiteName();
        }

        return implode('', $output);
    }
655904
public function getNestedName(
        string $delimiter = ".",
        string $name = ""
    ): string
    {
        $keys = array_filter([$this->name, $name], "strlen");
        $parent = $this;
        while ($parent = $parent->getParent()) {
            $name = $parent->getName();
            if ($name) {
                array_unshift($keys, $parent->getName());
            }
        }
        return implode($delimiter, $keys);
    }
755487
public function getSubdomain(int $level = null)
    {
        $domain = $this->getDomain();

        if (is_null($domain)) {
            return null;
        }

        $return = substr($this->getHost(), 0, -strlen($this->getDomain()) - 1);

        if (!$return) {
            return null;
        }

        if (is_null($level)) {
            return $return;
        }

        return implode('.', array_slice(
            explode('.', $return),
            $level > 0 ? 0 : $level,
            1
        ));
    }
945216
public static function phpToPsrLevel($level, $default = LogLevel::DEBUG): string
    {
        return isset(self::$psrLogLevels[$level]) ? self::$psrLogLevels[$level] : $default;
    }
619057
protected function getMergedLinesText(array $parent, array $children)
    {
        $childrenTexts = array();
        foreach ($children as $child) {
            $childrenTexts[] = $child[Tag::Product];
        }
        $childrenText = ' (' . implode(', ', $childrenTexts) . ')';
        return $parent[Tag::Product] .  $childrenText;
    }
305798
public static function getLevelByName($level)
    {
        $level = strtoupper($level);
        if (!isset(static::$levelNameToLevel[$level])) {
            return static::ALL;
        }

        return static::$levelNameToLevel[$level];
    }
459445
public static function toNested(array $flat, $delimiter = '.')
    {
        $tree = [];

        foreach ($flat as $key => $val) {

            // Get parent parts and the current leaf
            $parts = static::splitPath($key, $delimiter);
            $leafPart = array_pop($parts);

            // Build parent structure
            $parent = &$tree;

            foreach ($parts as $part) {
                if (!isset($parent[$part])) {
                    $parent[$part] = [];
                } elseif (!is_array($parent[$part])) {
                    $parent[$part] = [];
                }

                $parent = &$parent[$part];
            }

            // Add the final part to the structure
            if (empty($parent[$leafPart])) {
                $parent[$leafPart] = $val;
            }
        }

        return $tree;
    }
684325
public static final function frns(string $string, string $separator = '.'): string {
		return implode($separator, preg_split('/\\\/', trim(strtolower($string)), -
			1, PREG_SPLIT_NO_EMPTY));
	}
1247724
public function slug($separator = '-')
    {
        $str = $this->toAscii();

        $flip = $separator == '-' ? '_' : '-';
        $str = str_replace('.', $separator, $str);
        $str = preg_replace('!['.preg_quote($flip).']+!u', $separator, $str);
        $str = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($str));
        $str = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $str);

        return trim($str, $separator);
    }
647240
public function getDot(string $notation, string $separator = '.')
    {
        $args = explode($separator, $notation);

        if (count($args) == 0) {
            return null;
        }

        $last = array_pop($args);
        $pointer = &$this->data;

        foreach ($args as $step) {
            if (!isset($pointer[$step])) {
                return null;
            }

            $pointer = &$pointer[$step];
        }

        if (!isset($pointer[$last])) {
            return null;
        }

        return $pointer[$last];
    }
184822
public function getTitleText()
    {
        if ($this->UseLevelTitle && ($page = $this->getCurrentPage(Page::class))) {
            return $page->MenuTitle;
        }
        
        return parent::getTitleText();
    }
150508
public function getPath($separator=' > ', $includeNode=false)
    {
        $path = array();

        $ancestors = $this->getAncestors();
        if($ancestors)
        {
            foreach($ancestors as $ancestor)
            {
                $path[] = $ancestor->getNode()->__toString();
            }
        }

        if($includeNode)
        {
            $path[] = $this->getNode()->__toString();
        }

        return implode($separator, $path);
    }