Code Duplication    Length = 12-12 lines in 2 locations

src/Show/Field.php 2 locations

@@ 210-221 (lines=12) @@
207
     *
208
     * @return Field
209
     */
210
    public function label($style = 'success')
211
    {
212
        return $this->as(function ($value) use ($style) {
213
            if ($value instanceof Arrayable) {
214
                $value = $value->toArray();
215
            }
216
217
            return collect((array) $value)->map(function ($name) use ($style) {
218
                return "<span class='label label-{$style}'>$name</span>";
219
            })->implode('&nbsp;');
220
        });
221
    }
222
223
    /**
224
     * Show field as badges.
@@ 230-241 (lines=12) @@
227
     *
228
     * @return Field
229
     */
230
    public function badge($style = 'blue')
231
    {
232
        return $this->as(function ($value) use ($style) {
233
            if ($value instanceof Arrayable) {
234
                $value = $value->toArray();
235
            }
236
237
            return collect((array) $value)->map(function ($name) use ($style) {
238
                return "<span class='badge bg-{$style}'>$name</span>";
239
            })->implode('&nbsp;');
240
        });
241
    }
242
243
    /**
244
     * Show field as json code.