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

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