<commit_before><?php

namespace Nelliel;

if (!defined('NELLIEL_VERSION'))
{
    die("NOPE.AVI");
}

class FileHandler
{

    function __construct()
    {
    }

    public function writeFile($file, $output, $chmod = FILE_PERM, $create_directories = false, $dir_chmod = DIRECTORY_PERM, $temp_move = true)
    {
        $file_final = $file;

        if ($create_directories)
        {
            $this->createDirectory(dirname($file), $dir_chmod, true);
        }

        if ($temp_move)
        {
            $file = uniqid();
        }

        $result = file_put_contents($file, $output, LOCK_EX);

        if ($result !== false)
        {
            if ($temp_move)
            {
                $this->moveFile($file, $file_final);
            }

            chmod($file_final, octdec($chmod));
        }

        return $result;
    }

    public function createDirectory($directory, $dir_chmod = DIRECTORY_PERM, $recursive = false)
    {
        clearstatcache();

        if (is_dir($directory))
        {
            return false;
        }

        return @mkdir($directory, octdec($dir_chmod), $recursive);
    }

    public function moveFile($file, $destination, $create_directories = false, $dir_chmod = DIRECTORY_PERM)
    {
        clearstatcache();

        if ($create_directories)
        {
            $this->createDirectory(dirname($destination), $dir_chmod, true);
        }

        if (file_exists($file))
        {
            return rename($file, $destination);
        }

        return false;
    }

    public function eraserGun($path, $filename = null, $is_directory = false)
    {
        clearstatcache();

        if ($is_directory && file_exists($path))
        {
            $files = glob($this->pathFileJoin($path, '*'));

            foreach ($files as $file)
            {
                if (is_dir($file))
                {
                    $this->eraserGun($file, null, true);
                }

                unlink($file);
            }

            @rmdir($path);
        }
        else if (file_exists($this->pathFileJoin($path, $filename)))
        {<commit_msg>Fix a file doesn't exist error<commit_after><?php

namespace Nelliel;

if (!defined('NELLIEL_VERSION'))
{
    die("NOPE.AVI");
}

class FileHandler
{

    function __construct()
    {
    }

    public function writeFile($file, $output, $chmod = FILE_PERM, $create_directories = false, $dir_chmod = DIRECTORY_PERM, $temp_move = true)
    {
        $file_final = $file;

        if ($create_directories)
        {
            $this->createDirectory(dirname($file), $dir_chmod, true);
        }

        if ($temp_move)
        {
            $file = uniqid();
        }

        $result = file_put_contents($file, $output, LOCK_EX);

        if ($result !== false)
        {
            if ($temp_move)
            {
                $this->moveFile($file, $file_final);
            }

            chmod($file_final, octdec($chmod));
        }

        return $result;
    }

    public function createDirectory($directory, $dir_chmod = DIRECTORY_PERM, $recursive = false)
    {
        clearstatcache();

        if (is_dir($directory))
        {
            return false;
        }

        return @mkdir($directory, octdec($dir_chmod), $recursive);
    }

    public function moveFile($file, $destination, $create_directories = false, $dir_chmod = DIRECTORY_PERM)
    {
        clearstatcache();

        if ($create_directories)
        {
            $this->createDirectory(dirname($destination), $dir_chmod, true);
        }

        if (file_exists($file))
        {
            return rename($file, $destination);
        }

        return false;
    }

    public function eraserGun($path, $filename = null, $is_directory = false)
    {
        clearstatcache();

        if ($is_directory && file_exists($path))
        {
            $files = glob($this->pathFileJoin($path, '*'));

            foreach ($files as $file)
            {
                if (is_dir($file))
                {
                    $this->eraserGun($file, null, true);
                }
                else
                {
                    unlink($file);
                }
            }

            @rmdir($path);
        }
        else if (file_exists($this->pathFileJoin($path, $filename)))
        {
{'fraction_non_alphanumeric': 0.13031358885017422, 'fraction_numerical': 0.0, 'mean_word_length': 1.6979949874686717, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '4253155', 'n_tokens_mistral': 1311, 'n_tokens_neox': 1237, 'n_words': 232}