<commit_before><?php
namespace ManaPHP\Helper;

use ManaPHP\Di;
use ManaPHP\Exception\CreateDirectoryFailedException;
use ManaPHP\Exception\FileNotFoundException;
use ManaPHP\Exception\RuntimeException;

class LocalFS
{
    /**
     * @var \ManaPHP\AliasInterface
     */
    public static $alias;

    /**
     * Determine if a file exists.
     *
     * @param string $file
     *
     * @return bool
     */
    public static function fileExists($file)
    {
        return is_file(self::$alias->resolve($file));
    }

    /**
     * @param string $file
     *
     * @return int|false
     */
    public static function fileSize($file)
    {
        return @filesize(self::$alias->resolve($file));
    }

    /**
     * @param string $file
     *
     * @return void
     */
    public static function fileDelete($file)
    {
        foreach (self::files($file) as $f) {
            if (!unlink($f) && self::fileExists($f)) {
                throw new RuntimeException(['delete `:file` failed: :last_error_message', 'file' => $f]);
            }
        }
    }

    /**
     * @param string $dir
     * @param int    $mode
     *
     * @return void
     */
    protected static function _dirCreate($dir, $mode = 0755)
    {
        /** @noinspection NotOptimalIfConditionsInspection */
        if (!is_dir($dir) && !@mkdir($dir, $mode, true) && !is_dir($dir)) {<commit_msg>Modified   ManaPHP/Helper/LocalFS.php<commit_after><?php
namespace ManaPHP\Helper;

use ManaPHP\Di;
use ManaPHP\Exception\CreateDirectoryFailedException;
use ManaPHP\Exception\FileNotFoundException;
use ManaPHP\Exception\RuntimeException;

class LocalFS
{
    /**
     * @var \ManaPHP\AliasInterface
     */
    public static $alias;

    /**
     * Determine if a file exists.
     *
     * @param string $file
     *
     * @return bool
     */
    public static function fileExists($file)
    {
        return is_file(self::$alias->resolve($file));
    }

    /**
     * @param string $file
     *
     * @return int|false
     */
    public static function fileSize($file)
    {
        return @filesize(self::$alias->resolve($file));
    }

    /**
     * @param string $file
     *
     * @return void
     */
    public static function fileDelete($file)
    {
        if (Str::contains($file, '*')) {
            foreach (self::files($file) as $f) {
                if (!unlink($f) && self::fileExists($f)) {
                    throw new RuntimeException(['delete `:file` failed: :last_error_message', 'file' => $f]);
                }
            }
        } else {
            $file = self::$alias->resolve($file);

            if (!unlink($file) && self::fileExists($file)) {
                throw new RuntimeException(['delete `:file` failed: :last_error_message', 'file' => $file]);
            }
        }
    }

    /**
     * @param string $dir
     * @param int    $mode
     *
     * @return void
     */
    protected static function _dirCreate($dir, $mode = 0755)
    {
        /** @noinspection NotOptimalIfConditionsInspection */
        if (!is_dir($dir) && !@mkdir($dir, $mode, true) && !is_dir($dir)) {
{'fraction_non_alphanumeric': 0.14740907627936917, 'fraction_numerical': 0.002574831026713872, 'mean_word_length': 2.1299093655589125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '6687491', 'n_tokens_mistral': 964, 'n_tokens_neox': 945, 'n_words': 199}