<commit_before><?php

namespace App\Service;

use App\Normalizer\DTO;
use App\Normalizer\Entity;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
use Symfony\Component\Serializer\Serializer;

/**
 * Class SerializerFactory
 * Ensures that we only serialize the things we want to
 * and don't fall back to any defaults.
 *
 */
class SerializerFactory
{
    /**
     * Build our own serializer just the way we like it
     * @param Entity $entityNormalizer
     * @param DTO $dtoNormalizer
     * @return Serializer
     */
    public static function createSerializer(Entity $entityNormalizer, DTO $dtoNormalizer)
    {
        $jsonEncoder = new JsonEncoder();
        $array = new ArrayDenormalizer();
        $dateTime = new DateTimeNormalizer();
        $processors = [$array, $dateTime, $jsonEncoder, $entityNormalizer, $dtoNormalizer];
        return new Serializer($processors, $processors);
    }
}
<commit_msg>Clean up what we pass to the serializer<commit_after><?php

namespace App\Service;

use App\Normalizer\DTO;
use App\Normalizer\Entity;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
use Symfony\Component\Serializer\Serializer;

/**
 * Class SerializerFactory
 * Ensures that we only serialize the things we want to
 * and don't fall back to any defaults.
 *
 */
class SerializerFactory
{
    /**
     * Build our own serializer just the way we like it
     * @param Entity $entityNormalizer
     * @param DTO $dtoNormalizer
     * @return Serializer
     */
    public static function createSerializer(Entity $entityNormalizer, DTO $dtoNormalizer)
    {
        $jsonEncoder = new JsonEncoder();
        $array = new ArrayDenormalizer();
        $dateTime = new DateTimeNormalizer();
        return new Serializer([$array, $dateTime, $entityNormalizer, $dtoNormalizer], [$jsonEncoder]);
    }
}

{'fraction_non_alphanumeric': 0.09528392685274302, 'fraction_numerical': 0.0, 'mean_word_length': 3.9033018867924527, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4420038', 'n_tokens_mistral': 586, 'n_tokens_neox': 583, 'n_words': 164}