FactoriesLoader::getNamespace()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace LaravelModulize\Services\Loaders;
4
5
class FactoriesLoader 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->registerEloquentFactoriesFrom($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/factories";
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