public function sanitizePath($string)
    {
        if (!is_string($string) || empty($string)) {
            return '';
        }

        $replace = [
            '/\s+/'    => '_',
            '/\*{1,}/' => '',
            '/\.{2,}/' => '.',
            '/^\./'    => '',
            '/\.$/'    => '',
        ];

        return preg_replace(
            array_keys($replace),
            array_values($replace),
            trim($string)
        );
    }