Code Duplication    Length = 15-15 lines in 2 locations

src/Card.php 1 location

@@ 337-351 (lines=15) @@
334
     * @param CardAttribute|\Closure $attribute
335
     * @return $this
336
     */
337
    public function addAttribute($attribute)
338
    {
339
        if ($attribute instanceof CardAttribute) {
340
            $this->attributes[] = $attribute;
341
            return $this;
342
        }
343
344
        if ($attribute instanceof \Closure) {
345
            $attribute($new = new CardAttribute());
346
            $this->attributes[] = $new;
347
            return $this;
348
        }
349
350
        throw new \InvalidArgumentException('Invalid attribute type. Expected '.CardAttribute::class.' or '.\Closure::class.'.');
351
    }
352
353
    /**
354
     * Get an array representation of the Card.

src/HipChatMessage.php 1 location

@@ 241-255 (lines=15) @@
238
     * @param Card|\Closure|null $card
239
     * @return $this
240
     */
241
    public function card($card)
242
    {
243
        if ($card instanceof Card) {
244
            $this->card = $card;
245
            return $this;
246
        }
247
248
        if ($card instanceof \Closure) {
249
            $card($new = new Card());
250
            $this->card = $new;
251
            return $this;
252
        }
253
254
        throw new \InvalidArgumentException('Invalid Card type. Expected '.Card::class.' or '.\Closure::class.'.');
255
    }
256
257
    /**
258
     * Sets the id of the "parent" message to attach this notification to.