Code Duplication    Length = 12-12 lines in 2 locations

src/Show/Field.php 2 locations

@@ 299-310 (lines=12) @@
296
     *
297
     * @return Field
298
     */
299
    public function label($style = 'success')
300
    {
301
        return $this->as(function ($value) use ($style) {
302
            if ($value instanceof Arrayable) {
303
                $value = $value->toArray();
304
            }
305
306
            return collect((array) $value)->map(function ($name) use ($style) {
307
                return "<span class='label label-{$style}'>$name</span>";
308
            })->implode('&nbsp;');
309
        });
310
    }
311
312
    /**
313
     * Show field as badges.
@@ 319-330 (lines=12) @@
316
     *
317
     * @return Field
318
     */
319
    public function badge($style = 'blue')
320
    {
321
        return $this->as(function ($value) use ($style) {
322
            if ($value instanceof Arrayable) {
323
                $value = $value->toArray();
324
            }
325
326
            return collect((array) $value)->map(function ($name) use ($style) {
327
                return "<span class='badge bg-{$style}'>$name</span>";
328
            })->implode('&nbsp;');
329
        });
330
    }
331
332
    /**
333
     * Show field as json code.