Completed
Push — master ( 295ac9...0e0f05 )
by Mahmoud
03:34
created

Seeder::run()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 21
Code Lines 8

Duplication

Lines 18
Ratio 85.71 %

Importance

Changes 0
Metric Value
dl 18
loc 21
rs 8.7624
c 0
b 0
f 0
cc 5
eloc 8
nc 5
nop 0
1
<?php
2
3
namespace App\Port\Seeder\Abstracts;
4
5
use Illuminate\Database\Seeder as LaravelSeeder;
6
7
/**
8
 * Class Seeder.
9
 *
10
 * @author  Mahmoud Zalt <[email protected]>
11
 */
12
abstract class Seeder extends LaravelSeeder
13
{
14
15
    /**
16
     * Default seeders directory in the container
17
     *
18
     * @var  string
19
     */
20
    protected $seedersPath = '/Data/Seeders/';
21
22
    /**
23
     * Run the database seeds.
24
     *
25
     * @return void
26
     */
27
    public function run()
28
    {
29 View Code Duplication
        foreach (\App\Port\Butler\Portals\Facade\PortButler::getContainersNames() as $containerName) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
31
            $containersDirectory = base_path('app/Containers/' . $containerName . $this->seedersPath);
32
33
            if (\File::isDirectory($containersDirectory)) {
34
35
                $files = \File::allFiles($containersDirectory);
36
37
                foreach ($files as $seederClass) {
38
39
                    if (\File::isFile($seederClass)) {
40
                        $this->call($seederClass);
41
                    }
42
43
                }
44
45
            }
46
        }
47
    }
48
}
49