Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
33.33% covered (danger)
33.33%
1 / 3
CRAP
63.64% covered (warning)
63.64%
7 / 11
TagDataFormDataMapper
0.00% covered (danger)
0.00%
0 / 1
33.33% covered (danger)
33.33%
1 / 3
9.36
63.64% covered (warning)
63.64%
7 / 11
 mapDataToForms
0.00% covered (danger)
0.00%
0 / 1
4.05
85.71% covered (warning)
85.71%
6 / 7
 mapFormsToData
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 configureOptions
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
<?php declare(strict_types = 1);
//
// Generated by Smalldb\CodeCooker\Generator\DtoGenerator.
// Do NOT edit! All changes will be lost!
// 
// 
namespace Smalldb\StateMachine\Test\Example\Tag\TagData;
use Smalldb\CodeCooker\Annotation\GeneratedClass;
use Symfony\Component\Form\DataMapperInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
 * @GeneratedClass
 * @see \Smalldb\StateMachine\Test\Example\Tag\TagProperties
 */
class TagDataFormDataMapper implements DataMapperInterface
{
    public function mapDataToForms($viewData, iterable $forms)
    {
        if ($viewData === null) {
            return;
        } else if ($viewData instanceof TagData) {
            foreach ($forms as $prop => $field) {
                $field->setData(TagDataImmutable::get($viewData, $prop));
            }
        } else {
            throw new UnexpectedTypeException($viewData, TagDataImmutable::class);
        }
    }
    public function mapFormsToData(iterable $forms, & $viewData)
    {
        $viewData = TagDataImmutable::fromIterable($viewData, (function() use ($forms) { foreach($forms as $k => $field) yield $k => $field->getData(); })());
    }
    public function configureOptions(OptionsResolver $optionsResolver)
    {
        $optionsResolver->setDefault("empty_data", null);
        $optionsResolver->setDefault("data_class", TagData::class);
    }
}