protected function up($path, $level = 1, $preserveTrailingSlash = false)
    {
        $postfix = '';

        if (substr($path, -1, 1) === DIRECTORY_SEPARATOR) {
            ++$level;
            if ($preserveTrailingSlash) {
                $postfix = DIRECTORY_SEPARATOR;
            }
        }

        $path = explode(DIRECTORY_SEPARATOR, $path);
        $path = array_slice($path, 0, count($path) - $level);

        return implode(DIRECTORY_SEPARATOR, $path).$postfix;
    }