Code Duplication    Length = 12-12 lines in 2 locations

src/Show/Field.php 2 locations

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