<commit_before><?php
namespace phorkie;


class Tools
{
    /**
     * Delete an entire directory structure
     *
     * @param string $path Path to delete
     *
     * @return bool
     */
    public static function recursiveDelete($path)
    {
        if (!is_dir($path) || is_link($path)) {
            return unlink($path);
        }
        foreach (scandir($path) as $file) {
            if ($file == '.' || $file == '..') {
                continue;
            }
            $filepath = $path . DIRECTORY_SEPARATOR . $file;
            if (!static::recursiveDelete($filepath)) {
                return false;
            };
        }
        return rmdir($path);
    }

    /**
     * Create a full URL with protocol and host name
     *
     * @param string $path Path to the file, with leading /
     *<commit_msg>do not try to delete if file does not exist<commit_after><?php
namespace phorkie;


class Tools
{
    /**
     * Delete an entire directory structure
     *
     * @param string $path Path to delete
     *
     * @return bool
     */
    public static function recursiveDelete($path)
    {
        if (!file_exists($path)) {
            return true;
        }
        if (!is_dir($path) || is_link($path)) {
            return unlink($path);
        }
        foreach (scandir($path) as $file) {
            if ($file == '.' || $file == '..') {
                continue;
            }
            $filepath = $path . DIRECTORY_SEPARATOR . $file;
            if (!static::recursiveDelete($filepath)) {
                return false;
            };
        }
        return rmdir($path);
    }

    /**
     * Create a full URL with protocol and host name
     *
     * @param string $path Path to the file, with leading /
     *
{'fraction_non_alphanumeric': 0.12385844748858447, 'fraction_numerical': 0.0, 'mean_word_length': 1.555393586005831, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5793136', 'n_tokens_mistral': 505, 'n_tokens_neox': 492, 'n_words': 139}