<commit_before><?php

namespace Puphpet;

class Domain
{
    /**
     * @param mixed $values
     * @return array
     */
    public function explodeAndQuote($values)
    {
        $values = !empty($values) ? explode(',', $values) : [];

        return $this->quoteArray($values);
    }

    /**
     * @param $values
     * @return array
     */
    protected function quoteArray($values)
    {
        return array_map(function($value) {
                $value = str_replace("'", '', str_replace('"', '', $value));
                return "'{$value}'";
            },
            $values
        );
    }
}<commit_msg>Replaced array_map with a vanilla foreach. Angels cried.<commit_after><?php

namespace Puphpet;

class Domain
{
    /**
     * @param mixed $values
     * @return array
     */
    public function explodeAndQuote($values)
    {
        $values = !empty($values) ? explode(',', $values) : [];

        return $this->quoteArray($values);
    }

    /**
     * @param $values
     * @return array
     */
    protected function quoteArray($values)
    {
        foreach ($values as $id => $value) {
            $value = trim($value);

            if ($value == '') {
                unset($values[$id]);
                continue;
            }

            $value = str_replace("'", '', str_replace('"', '', $value));

            $values[$id] = "'{$value}'";
        }

        return $values;
    }
}
{'fraction_non_alphanumeric': 0.16713681241184766, 'fraction_numerical': 0.0, 'mean_word_length': 1.7933070866141732, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '2605958', 'n_tokens_mistral': 422, 'n_tokens_neox': 406, 'n_words': 87}