<commit_before><?php
namespace Swis\LaravelFulltext;

class TermBuilder {

    public static function terms($search){
        $wildcards = config('laravel-fulltext.enable_wildcards');

        $terms = collect(preg_split('/[\s,]+/', $search));

        if($wildcards === true){
            foreach ($terms as $key => $term) {
                $terms[$key] = $term. '*';
            }
        }
        return $terms;
    }

}
<commit_msg>fixed with transform instead of foreach<commit_after><?php
namespace Swis\LaravelFulltext;

class TermBuilder {

    public static function terms($search){
        $wildcards = config('laravel-fulltext.enable_wildcards');

        $terms = collect(preg_split('/[\s,]+/', $search));

        if($wildcards === true){
            $terms->transform(function($term){
                return $term. '*';
            });
        }

        return $terms;
    }

}

{'fraction_non_alphanumeric': 0.15548098434004473, 'fraction_numerical': 0.0, 'mean_word_length': 2.2545454545454544, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3351064', 'n_tokens_mistral': 281, 'n_tokens_neox': 256, 'n_words': 51}