Code Duplication    Length = 12-12 lines in 2 locations

src/Traits/EntrustUserTrait.php 2 locations

@@ 256-267 (lines=12) @@
253
     *
254
     * @param mixed $role
255
     */
256
    public function attachRole($role)
257
    {
258
        if (is_object($role)) {
259
            $role = $role->getKey();
260
        }
261
262
        if (is_array($role)) {
263
            $role = $role['id'];
264
        }
265
266
        $this->roles()->attach($role);
267
    }
268
269
    /**
270
     * Alias to eloquent many-to-many relation's detach() method.
@@ 274-285 (lines=12) @@
271
     *
272
     * @param mixed $role
273
     */
274
    public function detachRole($role)
275
    {
276
        if (is_object($role)) {
277
            $role = $role->getKey();
278
        }
279
280
        if (is_array($role)) {
281
            $role = $role['id'];
282
        }
283
284
        $this->roles()->detach($role);
285
    }
286
287
    /**
288
     * Attach multiple roles to a user