yii\BaseYii::getRootAlias PHP Method

getRootAlias() public static method

A root alias is an alias that has been registered via BaseYii::setAlias previously. If a given alias matches multiple root aliases, the longest one will be returned.
public static getRootAlias ( string $alias ) : string | boolean
$alias string the alias
return string | boolean the root alias, or false if no root alias is found
    public static function getRootAlias($alias)
    {
        $pos = strpos($alias, '/');
        $root = $pos === false ? $alias : substr($alias, 0, $pos);
        if (isset(static::$aliases[$root])) {
            if (is_string(static::$aliases[$root])) {
                return $root;
            } else {
                foreach (static::$aliases[$root] as $name => $path) {
                    if (strpos($alias . '/', $name . '/') === 0) {
                        return $name;
                    }
                }
            }
        }
        return false;
    }