Code Duplication    Length = 18-18 lines in 2 locations

src/Generators/DataTablesMakeCommand.php 1 location

@@ 305-322 (lines=18) @@
302
     * @param string $name
303
     * @return string
304
     */
305
    protected function qualifyClass($name)
306
    {
307
        $rootNamespace = $this->laravel->getNamespace();
308
309
        if (Str::startsWith($name, $rootNamespace)) {
310
            return $name;
311
        }
312
313
        if (Str::contains($name, '/')) {
314
            $name = str_replace('/', '\\', $name);
315
        }
316
317
        if (! Str::contains(Str::lower($name), 'datatable')) {
318
            $name .= 'DataTable';
319
        }
320
321
        return $this->getDefaultNamespace(trim($rootNamespace, '\\')) . '\\' . $name;
322
    }
323
324
    /**
325
     * Get the default namespace for the class.

src/Generators/DataTablesHtmlCommand.php 1 location

@@ 76-93 (lines=18) @@
73
     * @param string $name
74
     * @return string
75
     */
76
    protected function qualifyClass($name)
77
    {
78
        $rootNamespace = $this->laravel->getNamespace();
79
80
        if (Str::startsWith($name, $rootNamespace)) {
81
            return $name;
82
        }
83
84
        if (Str::contains($name, '/')) {
85
            $name = str_replace('/', '\\', $name);
86
        }
87
88
        if (! Str::contains(Str::lower($name), 'datatable')) {
89
            $name .= 'DataTableHtml';
90
        }
91
92
        return $this->getDefaultNamespace(trim($rootNamespace, '\\')) . '\\' . $name;
93
    }
94
}
95