Code Duplication    Length = 13-14 lines in 2 locations

src/Listing/Listing.php 1 location

@@ 33-46 (lines=14) @@
30
     * @param TypeInterface[] $types
31
     * @param string          $class
32
     */
33
    public function __construct(array $types, $class)
34
    {
35
        foreach ($types as $type) {
36
            if (!$type instanceof TypeInterface) {
37
                throw new \InvalidArgumentException(sprintf(
38
                    'Type must be an instance of %s, %s given!',
39
                    'Saxulum\Crud\Listing\Type\TypeInterface',
40
                    is_object($type) ? get_class($type) : gettype($type)
41
                ));
42
            }
43
            $this->types[$type->getName()] = $type;
44
        }
45
        $this->reflectionClass = new \ReflectionClass($class);
46
    }
47
48
    /**
49
     * @param string $name

src/Listing/ListingFactory.php 1 location

@@ 17-29 (lines=13) @@
14
    /**
15
     * @param TypeInterface[] $types
16
     */
17
    public function __construct(array $types)
18
    {
19
        foreach ($types as $type) {
20
            if (!$type instanceof TypeInterface) {
21
                throw new \InvalidArgumentException(sprintf(
22
                    'Type must be an instance of %s, %s given!',
23
                    'Saxulum\Crud\Listing\Type\TypeInterface',
24
                    is_object($type) ? get_class($type) : gettype($type)
25
                ));
26
            }
27
            $this->types[$type->getName()] = $type;
28
        }
29
    }
30
31
    /**
32
     * @param string $class