Code Duplication    Length = 6-9 lines in 3 locations

lib/Subscriber/Behavior/Audit/BlameSubscriber.php 1 location

@@ 131-136 (lines=6) @@
128
129
        $user = $token->getUser();
130
131
        if (!$user instanceof UserInterface) {
132
            throw new \InvalidArgumentException(sprintf(
133
                'User must implement the Sulu UserInterface, got "%s"',
134
                is_object($user) ? get_class($user) : gettype($user)
135
            ));
136
        }
137
138
        return $user->getId();
139
    }

lib/Subscriber/Core/MappingSubscriber.php 1 location

@@ 277-285 (lines=9) @@
274
275
    private function validateFieldValue($value, $fieldName, $fieldMapping)
276
    {
277
        if ($fieldMapping['multiple'] && !is_array($value)) {
278
            throw new \InvalidArgumentException(
279
                sprintf(
280
                    'Field "%s" is mapped as multiple, and therefore must be an array, got "%s"',
281
                    $fieldName,
282
                    is_object($value) ? get_class($value) : gettype($value)
283
                )
284
            );
285
        }
286
    }
287
}
288

lib/Subscriber/Phpcr/QuerySubscriber.php 1 location

@@ 76-81 (lines=6) @@
73
            $phpcrQuery = $this->getQueryManager()->createQuery($innerQuery, QueryInterface::JCR_SQL2);
74
        } elseif ($innerQuery instanceof QueryInterface) {
75
            $phpcrQuery = $innerQuery;
76
        } else {
77
            throw new \InvalidArgumentException(sprintf(
78
                'Expected inner query to be either a string or a PHPCR query object, got: "%s"',
79
                is_object($innerQuery) ? get_class($innerQuery) : gettype($innerQuery)
80
            ));
81
        }
82
83
        $event->setQuery(
84
            new Query(