public static function arrayToFile($array, $file)
    {
        self::createDirectory($file);

        $lastError = JsonLastError::check();

        $json = json_encode($lastError ? $lastError : $array, JSON_PRETTY_PRINT);

        self::saveFile($file, $json);

        return is_null($lastError);
    }