<commit_before><?php

namespace YoutubeDl\Mapper;

use YoutubeDl\Entity\Format;

class FormatsMapper implements MapperInterface
{
    public function map($data)
    {
        echo 'loaded formats';
        $formats = [];

        foreach ($data as $format) {
            $entity = new Format();
            $reflection = new \ReflectionObject($entity);

            foreach ($format as $field => $value) {
                $prop = $reflection->getProperty(lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $field)))));
                $prop->setAccessible(true);
                $prop->setValue($entity, $value);
            }

            $formats[] = $entity;
        }
<commit_msg>Update FormatsMapper.php<commit_after><?php

namespace YoutubeDl\Mapper;

use YoutubeDl\Entity\Format;

class FormatsMapper implements MapperInterface
{
    public function map($data)
    {
        $formats = [];

        foreach ($data as $format) {
            $entity = new Format();
            $reflection = new \ReflectionObject($entity);

            foreach ($format as $field => $value) {
                $prop = $reflection->getProperty(lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $field)))));
                $prop->setAccessible(true);
                $prop->setValue($entity, $value);
            }

            $formats[] = $entity;
        }

{'fraction_non_alphanumeric': 0.14516129032258066, 'fraction_numerical': 0.0, 'mean_word_length': 2.189252336448598, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '3489497', 'n_tokens_mistral': 391, 'n_tokens_neox': 374, 'n_words': 78}