Code Duplication    Length = 12-12 lines in 2 locations

src/Show/Field.php 2 locations

@@ 357-368 (lines=12) @@
354
     *
355
     * @return Field
356
     */
357
    public function label($style = 'success')
358
    {
359
        return $this->unescape()->as(function ($value) use ($style) {
360
            if ($value instanceof Arrayable) {
361
                $value = $value->toArray();
362
            }
363
364
            return collect((array) $value)->map(function ($name) use ($style) {
365
                return "<span class='label label-{$style}'>$name</span>";
366
            })->implode('&nbsp;');
367
        });
368
    }
369
370
    /**
371
     * Show field as badges.
@@ 377-388 (lines=12) @@
374
     *
375
     * @return Field
376
     */
377
    public function badge($style = 'blue')
378
    {
379
        return $this->unescape()->as(function ($value) use ($style) {
380
            if ($value instanceof Arrayable) {
381
                $value = $value->toArray();
382
            }
383
384
            return collect((array) $value)->map(function ($name) use ($style) {
385
                return "<span class='badge bg-{$style}'>$name</span>";
386
            })->implode('&nbsp;');
387
        });
388
    }
389
390
    /**
391
     * Show field as json code.