public static function splitPath(string $path, bool $safe = null): array
    {
        if ($path === '') {
            return [];
        }

        $safe = ($safe === null ? self::$safeSeparationMode : $safe);

        if ($safe) {
            $segments = preg_split('~\\\\' . self::$separator . '(*SKIP)(*F)|\.~s', $path, -1, PREG_SPLIT_NO_EMPTY);

            if ($segments === false) {
                // actually this code can't be covered with tests, because i don't know how to make preg_split()
                // return a FALSE value but handling it in case some one will %)
                trigger_error('Path splitting failed, received path: ' . $path);

                $segments = [];
            }

            foreach ($segments as &$segment) {
                $segment = stripslashes($segment);
            }

            return $segments;
        }

        return explode(self::$separator, $path);
    }