Code Duplication    Length = 11-14 lines in 4 locations

src/Tree/Tools.php 1 location

@@ 56-69 (lines=14) @@
53
     *
54
     * @return string
55
     */
56
    public function render()
57
    {
58
        return $this->tools->map(function ($tool) {
59
            if ($tool instanceof Renderable) {
60
                return $tool->render();
61
            }
62
63
            if ($tool instanceof Htmlable) {
64
                return $tool->toHtml();
65
            }
66
67
            return (string) $tool;
68
        })->implode(' ');
69
    }
70
}
71

src/Show/Tools.php 1 location

@@ 294-307 (lines=14) @@
291
     *
292
     * @return mixed
293
     */
294
    protected function renderCustomTools($tools)
295
    {
296
        return $tools->map(function ($tool) {
297
            if ($tool instanceof Renderable) {
298
                return $tool->render();
299
            }
300
301
            if ($tool instanceof Htmlable) {
302
                return $tool->toHtml();
303
            }
304
305
            return (string) $tool;
306
        })->implode(' ');
307
    }
308
309
    /**
310
     * Render tools.

src/Form/Tools.php 1 location

@@ 331-341 (lines=11) @@
328
            return '';
329
        }
330
331
        return $tools->map(function ($tool) {
332
            if ($tool instanceof Renderable) {
333
                return $tool->render();
334
            }
335
336
            if ($tool instanceof Htmlable) {
337
                return $tool->toHtml();
338
            }
339
340
            return (string) $tool;
341
        })->implode(' ');
342
    }
343
344
    /**

src/Grid/Column/HasHeader.php 1 location

@@ 116-129 (lines=14) @@
113
     *
114
     * @return string
115
     */
116
    public function renderHeader()
117
    {
118
        return collect($this->headers)->map(function ($item) {
119
            if ($item instanceof Renderable) {
120
                return $item->render();
121
            }
122
123
            if ($item instanceof Htmlable) {
124
                return $item->toHtml();
125
            }
126
127
            return (string)$item;
128
        })->implode('');
129
    }
130
}
131