Code Duplication    Length = 6-6 lines in 2 locations

src/Standard/View/CollectionType.php 1 location

@@ 24-29 (lines=6) @@
21
22
    public function createView(ViewFactory $factory, $data, array $options): ViewInterface
23
    {
24
        if (!is_array($data) && !$data instanceof \Traversable) {
25
            throw new \InvalidArgumentException(sprintf(
26
                'Data must be traversable or an array, got: "%s"',
27
                is_object($data) ? get_class($data) : gettype($data)
28
            ));
29
        }
30
31
        if (is_array($data)) {
32
            $data = new \ArrayIterator($data);

src/Standard/View/ScalarType.php 1 location

@@ 17-22 (lines=6) @@
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($options['template'], $data);
25
    }