<commit_before><?php

namespace Percy\Http;

use InvalidArgumentException;

trait QueryStringParserTrait
{
    /**
     * @var integer
     */
    protected $param = 0;

    /**
     * Parse HTTP query string and return array representation
     * to be attached to a database query.
     *
     * @param string $query
     *
     * @return array
     */
    public function parseQueryString($query)
    {
        if (empty($query)) {
            return [];
        }

        parse_str($query, $split);

        $query = [];

        while (list($key, $value) = each($split)) {
            $mapped = call_user_func_array([$this, 'filterQueryParams'], [$key, $value]);
            if ($mapped !== false) {
                $query[$key] = $mapped;
            }
        }

        return $query;
    }
<commit_msg>Remove each() usage for 7.2 support<commit_after><?php

namespace Percy\Http;

use InvalidArgumentException;

trait QueryStringParserTrait
{
    /**
     * @var integer
     */
    protected $param = 0;

    /**
     * Parse HTTP query string and return array representation
     * to be attached to a database query.
     *
     * @param string $query
     *
     * @return array
     */
    public function parseQueryString($query)
    {
        if (empty($query)) {
            return [];
        }

        parse_str($query, $split);

        $query = [];

        foreach ($split as $key => $value) {
            $mapped = call_user_func_array([$this, 'filterQueryParams'], [$key, $value]);
            if ($mapped !== false) {
                $query[$key] = $mapped;
            }
        }

        return $query;
    }

{'fraction_non_alphanumeric': 0.12995729103111653, 'fraction_numerical': 0.0024405125076266015, 'mean_word_length': 1.8082191780821917, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '2346606', 'n_tokens_mistral': 484, 'n_tokens_neox': 468, 'n_words': 120}