Code Duplication    Length = 18-18 lines in 2 locations

src/Generators/DataTablesHtmlCommand.php 1 location

@@ 61-78 (lines=18) @@
58
     * @param string $name
59
     * @return string
60
     */
61
    protected function qualifyClass($name)
62
    {
63
        $rootNamespace = $this->laravel->getNamespace();
64
65
        if (Str::startsWith($name, $rootNamespace)) {
66
            return $name;
67
        }
68
69
        if (Str::contains($name, '/')) {
70
            $name = str_replace('/', '\\', $name);
71
        }
72
73
        if (! Str::contains(Str::lower($name), 'datatable')) {
74
            $name .= 'DataTableHtml';
75
        }
76
77
        return $this->getDefaultNamespace(trim($rootNamespace, '\\')) . '\\' . $name;
78
    }
79
80
    /**
81
     * Get the stub file for the generator.

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.