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/Widgets/Navbar.php 1 location

@@ 78-88 (lines=11) @@
75
            $this->right(new RefreshButton());
76
        }
77
78
        return $this->elements[$part]->map(function ($element) {
79
            if ($element instanceof Htmlable) {
80
                return $element->toHtml();
81
            }
82
83
            if ($element instanceof Renderable) {
84
                return $element->render();
85
            }
86
87
            return (string) $element;
88
        })->implode('');
89
    }
90
}
91