Code Duplication    Length = 15-15 lines in 2 locations

src/Card.php 1 location

@@ 343-357 (lines=15) @@
340
     * @param CardAttribute|\Closure $attribute
341
     * @return $this
342
     */
343
    public function addAttribute($attribute)
344
    {
345
        if ($attribute instanceof CardAttribute) {
346
            $this->attributes[] = $attribute;
347
348
            return $this;
349
        }
350
351
        if ($attribute instanceof \Closure) {
352
            $attribute($new = new CardAttribute());
353
            $this->attributes[] = $new;
354
355
            return $this;
356
        }
357
358
        throw new \InvalidArgumentException('Invalid attribute type. Expected '.CardAttribute::class.' or '.\Closure::class.'.');
359
    }
360

src/HipChatMessage.php 1 location

@@ 261-275 (lines=15) @@
258
     * @param Card|\Closure|null $card
259
     * @return $this
260
     */
261
    public function card($card)
262
    {
263
        if ($card instanceof Card) {
264
            $this->card = $card;
265
266
            return $this;
267
        }
268
269
        if ($card instanceof \Closure) {
270
            $card($new = new Card());
271
            $this->card = $new;
272
273
            return $this;
274
        }
275
276
        throw new \InvalidArgumentException('Invalid Card type. Expected '.Card::class.' or '.\Closure::class.'.');
277
    }
278