Code Duplication    Length = 7-7 lines in 2 locations

src/Version/Collection.php 1 location

@@ 243-249 (lines=7) @@
240
     */
241
    public function add($element)
242
    {
243
        if (!$element instanceof VersionInterface) {
244
            throw new InvalidArgumentException(sprintf(
245
                'Invalid type "%s". Can only add instances of "%s" to this collection.',
246
                VersionInterface::class,
247
                is_object($element) ? get_class($element) : gettype($element)
248
            ));
249
        }
250
251
        if ($this->validate($element)) {
252
            parent::add($element);

src/Version/Collection/Resolver/ResolverStack.php 1 location

@@ 46-52 (lines=7) @@
43
    public function __construct(array $resolvers, $cacheEnabled = true)
44
    {
45
        foreach ($resolvers as $resolver) {
46
            if (!is_object($resolver) || !$resolver instanceof ResolverInterface) {
47
                throw new InvalidArgumentException(sprintf(
48
                    'Invalid resolver of type "%s". Expected instance of "%s".',
49
                    is_object($resolver) ? get_class($resolver) : gettype($resolver),
50
                    ResolverInterface::class
51
                ));
52
            }
53
        }
54
        $this->resolvers = $resolvers;
55
        parent::__construct($cacheEnabled);