MigrationsLoader   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
eloc 6
dl 0
loc 36
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A loadFiles() 0 4 2
A getNamespace() 0 4 1
A getFilesPath() 0 3 1
1
<?php
2
3
namespace LaravelModulize\Services\Loaders;
4
5
class MigrationsLoader extends BaseFileLoader
6
{
7
    /**
8
     * Load the files to load and register them
9
     *
10
     * @param string $module
11
     * @return void
12
     */
13
    public function loadFiles(string $module): void
14
    {
15
        if (!$this->getFilesToLoad($module)->isEmpty()) {
16
            $this->repo->addMigration($this->getFilesPath($module));
17
        }
18
    }
19
20
    /**
21
     * Retrieve the path where the files to load should be at
22
     *
23
     * @param string $module
24
     * @return string
25
     */
26
    public function getFilesPath(string $module): string
27
    {
28
        return $this->repo->getModulePath($module) . "/database/migrations";
29
    }
30
31
    /**
32
     * Retrieve the namespace to be used when registering the files
33
     *
34
     * @param string $module
35
     * @return string
36
     */
37
    public function getNamespace(string $module): string
38
    {
39
        return $this->repo
40
            ->getModuleNamespace($module);
41
    }
42
43
}
44