<commit_before><?php declare(strict_types=1);

namespace ApiClients\Foundation\Hydrator;

use ApiClients\Foundation\Hydrator\Annotation;
use ApiClients\Tools\CommandBus\CommandBusInterface;
use React\EventLoop\LoopInterface;

class Factory
{
    const ANNOTATIONS = [
        Annotation\Collection::class => Annotation\Handler\CollectionHandler::class,
        Annotation\Nested::class => Annotation\Handler\NestedHandler::class,
        Annotation\Rename::class => Annotation\Handler\RenameHandler::class,
    ];

    public static function create(LoopInterface $loop, CommandBusInterface $commandBus, array $options = []): Hydrator
    {
        $options[Options::ANNOTATIONS] = static::annotations($options[Options::ANNOTATIONS] ?? []);

        $hydrator = new Hydrator($loop, $commandBus, $options);

        self::preheat($hydrator, $options);

        return $hydrator;
    }

    protected static function annotations(array $annotations): array<commit_msg>Made options mandatory for the factory create method<commit_after><?php declare(strict_types=1);

namespace ApiClients\Foundation\Hydrator;

use ApiClients\Foundation\Hydrator\Annotation;
use ApiClients\Tools\CommandBus\CommandBusInterface;
use React\EventLoop\LoopInterface;

class Factory
{
    const ANNOTATIONS = [
        Annotation\Collection::class => Annotation\Handler\CollectionHandler::class,
        Annotation\Nested::class => Annotation\Handler\NestedHandler::class,
        Annotation\Rename::class => Annotation\Handler\RenameHandler::class,
    ];

    public static function create(LoopInterface $loop, CommandBusInterface $commandBus, array $options): Hydrator
    {
        $options[Options::ANNOTATIONS] = static::annotations($options[Options::ANNOTATIONS] ?? []);

        $hydrator = new Hydrator($loop, $commandBus, $options);

        self::preheat($hydrator, $options);

        return $hydrator;
    }

    protected static function annotations(array $annotations): array
{'fraction_non_alphanumeric': 0.11569826707441386, 'fraction_numerical': 0.0010193679918450561, 'mean_word_length': 4.739766081871345, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '6765481', 'n_tokens_mistral': 555, 'n_tokens_neox': 529, 'n_words': 100}