public static function toPath($path, $ext = 'php', $root = '') {
        $ds = static::SEPARATOR;
        $path = static::ds($path);
        $dirs = explode($ds, $path);
        $file = array_pop($dirs);
        $path = implode($ds, $dirs) . $ds . str_replace('_', $ds, $file);

        if ($ext && mb_substr($path, -mb_strlen($ext)) !== $ext) {
            $path .= '.' . $ext;
        }

        if ($root) {
            $path = $root . $path;
        }

        return $path;
    }