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);
    }
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);
    }
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 ) ; }
Creating JSON file from array.

@param array  $array → array to be converted to JSON
@param string $file  → path to the file

@return boolean → true if the file is created without errors
Creating JSON file from array .