<commit_before><?php

namespace Psi\Component\ObjectAgent\Query\Converter;

use Psi\Component\ObjectAgent\Query\Comparison;
use Psi\Component\ObjectAgent\Query\Composite;
use Psi\Component\ObjectAgent\Query\Query;
use Psi\Component\ObjectAgent\Query\Join;

class ArrayConverter
{
    private static $comparisons = [
        Comparison::EQUALS,
        Comparison::NOT_EQUALS,
        Comparison::GREATER_THAN,
        Comparison::GREATER_THAN_EQUAL,
        Comparison::LESS_THAN,
        Comparison::LESS_THAN_EQUAL,
        Comparison::NULL,
        Comparison::NOT_NULL,
        Comparison::IN,
        Comparison::NOT_IN,
        Comparison::CONTAINS,
        Comparison::NOT_CONTAINS,
    ];

    private static $composites = [
        Composite::AND,
        Composite::OR,
    ];

    public function __invoke(array $query)
    {
        $query = $this->merge([
            'selects' => [],
            'from' => null,
            'criteria' => [],
            'orderings' => [],
            'joins' => [],
            'firstResult' => null,
            'maxResults' => null,
        ], $query);

        if (null === $query['from']) {
            throw new \InvalidArgumentException(sprintf(
                'You must specify the "from" part of the query.'
            ));
        }

        $query['criteria'] = new Composite(Composite::AND, $this->walkCriteria($query['criteria']));
        $query['joins'] = $this->walkJoins($query['joins']);
        $from = $query['from'];
        unset($query['from']);

        return Query::create($from, $query);
    }

    private function walkJoins(array $joins)
    {
        $joinObjects = [];

        foreach ($joins as $join) {
            $join = $this->merge([
                'type' => Join::INNER_JOIN,
                'join'=> null,
                'alias' => null,
            ], $join, [ 'join', 'alias']);
<commit_msg>Default criteria to null<commit_after><?php

namespace Psi\Component\ObjectAgent\Query\Converter;

use Psi\Component\ObjectAgent\Query\Comparison;
use Psi\Component\ObjectAgent\Query\Composite;
use Psi\Component\ObjectAgent\Query\Query;
use Psi\Component\ObjectAgent\Query\Join;

class ArrayConverter
{
    private static $comparisons = [
        Comparison::EQUALS,
        Comparison::NOT_EQUALS,
        Comparison::GREATER_THAN,
        Comparison::GREATER_THAN_EQUAL,
        Comparison::LESS_THAN,
        Comparison::LESS_THAN_EQUAL,
        Comparison::NULL,
        Comparison::NOT_NULL,
        Comparison::IN,
        Comparison::NOT_IN,
        Comparison::CONTAINS,
        Comparison::NOT_CONTAINS,
    ];

    private static $composites = [
        Composite::AND,
        Composite::OR,
    ];

    public function __invoke(array $query)
    {
        $query = $this->merge([
            'selects' => [],
            'from' => null,
            'criteria' => null,
            'orderings' => [],
            'joins' => [],
            'firstResult' => null,
            'maxResults' => null,
        ], $query);

        if (null === $query['from']) {
            throw new \InvalidArgumentException(sprintf(
                'You must specify the "from" part of the query.'
            ));
        }

        if ($query['criteria']) {
            $query['criteria'] = new Composite(Composite::AND, $this->walkCriteria($query['criteria']));
        }

        $query['joins'] = $this->walkJoins($query['joins']);
        $from = $query['from'];
        unset($query['from']);

        return Query::create($from, $query);
    }

    private function walkJoins(array $joins)
    {
        $joinObjects = [];

        foreach ($joins as $join) {
            $join = $this->merge([
                'type' => Join::INNER_JOIN,
                'join'=> null,
                'alias' => null,
            ], $join, [ 'join', 'alias']);

{'fraction_non_alphanumeric': 0.1481191222570533, 'fraction_numerical': 0.0, 'mean_word_length': 2.100404858299595, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '1544302', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1101, 'n_words': 200}