<commit_before>Optimized Symfony serializer
============================

Example Serializer/Deserializer for event `ArticleRenamedEvent`:

```php
use GpsLab\Domain\Event\Event;
use GpsLab\Domain\Event\Queue\Pull\PredisPullEventQueue;
use Symfony\Component\Serializer\Exception\UnsupportedException;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class ArticleRenamedEventSerializer implements NormalizerInterface, DenormalizerInterface
{
    const PATTERN = 'ArticleRenamed;%d;%d;%s';
    const REGEXP = '/^
            ArticleRenamed;     # event type
            (?<article_id>\d+); # article id
            (?<editor_id>\d+);  # editor of the change
            (?<new_name>.+      # new article name
        $/x';

    public function supportsNormalization($data, $format = null)
    {
        return $data instanceof ArticleRenamedEvent && $format == PredisPullEventQueue::FORMAT;
    }

    public function normalize($object, $format = null, array $context = [])
    {
        return sprintf(
            self::PATTERN,
            $object->articleId()->value(),<commit_msg>correct get default Symfony serializer format<commit_after>Optimized Symfony serializer
============================

Example Serializer/Deserializer for event `ArticleRenamedEvent`:

```php
use GpsLab\Domain\Event\Event;
use GpsLab\Domain\Event\Queue\Pull\PredisPullEventQueue;
use GpsLab\Domain\Event\Queue\Serializer\SymfonySerializer;
use Symfony\Component\Serializer\Exception\UnsupportedException;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

class ArticleRenamedEventSerializer implements NormalizerInterface, DenormalizerInterface
{
    const PATTERN = 'ArticleRenamed;%d;%d;%s';
    const REGEXP = '/^
            ArticleRenamed;     # event type
            (?<article_id>\d+); # article id
            (?<editor_id>\d+);  # editor of the change
            (?<new_name>.+      # new article name
        $/x';

    public function supportsNormalization($data, $format = null)
    {
        return $data instanceof ArticleRenamedEvent && $format == SymfonySerializer::DEFAULT_FORMAT;
    }

    public function normalize($object, $format = null, array $context = [])
    {
        return sprintf(
            self::PATTERN,
            $object->articleId()->value(),
{'fraction_non_alphanumeric': 0.12834224598930483, 'fraction_numerical': 0.0, 'mean_word_length': 3.7223300970873785, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '3497273', 'n_tokens_mistral': 698, 'n_tokens_neox': 655, 'n_words': 140}