Code Duplication    Length = 11-11 lines in 2 locations

src/Standard/View/DateTimeType.php 1 location

@@ 15-25 (lines=11) @@
12
13
class DateTimeType implements TypeInterface
14
{
15
    public function createView(ViewFactory $factory, $data, array $options): ViewInterface
16
    {
17
        if (null !== $data && !$data instanceof \DateTime) {
18
            throw new \InvalidArgumentException(sprintf(
19
                'DateTime view only accepts \DateTime objects, got "%s"',
20
                is_object($data) ? get_class($data) : gettype($data)
21
            ));
22
        }
23
24
        return new DateTimeView($data, $options['tag']);
25
    }
26
27
    public function configureOptions(OptionsResolver $options)
28
    {

src/Standard/View/ScalarType.php 1 location

@@ 15-25 (lines=11) @@
12
13
class ScalarType implements TypeInterface
14
{
15
    public function createView(ViewFactory $factory, $data, array $options): ViewInterface
16
    {
17
        if (null !== $data && !is_scalar($data)) {
18
            throw new \InvalidArgumentException(sprintf(
19
                'Scalar view only accepts scalar values! Got "%s"',
20
                is_object($data) ? get_class($data) : gettype($data)
21
            ));
22
        }
23
24
        return new ScalarView($data, $options['tag'], $options['raw']);
25
    }
26
27
    public function configureOptions(OptionsResolver $options)
28
    {