Code Duplication    Length = 22-22 lines in 2 locations

src/Services/FactoryService.php 1 location

@@ 9-30 (lines=22) @@
6
use Webfactor\Laravel\Generators\Contracts\ServiceInterface;
7
use Webfactor\Laravel\Generators\Traits\CanGenerateFile;
8
9
class FactoryService extends ServiceAbstract implements ServiceInterface
10
{
11
    use CanGenerateFile;
12
13
    protected $key = 'factory';
14
15
    public function getConsoleOutput() {
16
        return 'Generated factory file: '.$this->command->naming[$this->key]->getRelativeFilePath();
17
    }
18
19
    protected function buildFileContent()
20
    {
21
        $this->replaceModelRelatedStrings();
22
    }
23
24
    protected function replaceModelRelatedStrings()
25
    {
26
        $this->fileContent = str_replace('__model_namespace__', $this->command->naming['crudModel']->getNamespace(), $this->fileContent);
27
        $this->fileContent = str_replace('__model_class__', $this->command->naming['crudModel']->getClassName(), $this->fileContent);
28
    }
29
30
}
31

src/Services/SeederService.php 1 location

@@ 9-30 (lines=22) @@
6
use Webfactor\Laravel\Generators\Contracts\ServiceInterface;
7
use Webfactor\Laravel\Generators\Traits\CanGenerateFile;
8
9
class SeederService extends ServiceAbstract implements ServiceInterface
10
{
11
    use CanGenerateFile;
12
13
    protected $key = 'seeder';
14
15
    public function getConsoleOutput() {
16
        return 'Generated seeder: '.$this->command->naming[$this->key]->getRelativeFilePath();
17
    }
18
19
    protected function buildFileContent()
20
    {
21
        $this->replaceClassName();
22
        $this->replaceModelRelatedStrings();
23
    }
24
25
    protected function replaceModelRelatedStrings()
26
    {
27
        $this->fileContent = str_replace('__model_namespace__', $this->command->naming['crudModel']->getNamespace(), $this->fileContent);
28
        $this->fileContent = str_replace('__model_class__', $this->command->naming['crudModel']->getClassName(), $this->fileContent);
29
    }
30
}
31