Passed
Push — master ( b9fadf...5ad609 )
by Grupo
02:07
created

ModuleMaker::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: thales
5
 * Date: 24/11/2018
6
 * Time: 22:41
7
 */
8
9
namespace Saci\Console\Infrastructure\Domain\Services;
10
11
12
use Saci\Console\Domain\Entity\Module;
13
use Saci\Console\Domain\Exceptions\ModuleAlreadyExists;
14
use Symfony\Component\Filesystem\Filesystem;
15
16
class ModuleMaker implements \Saci\Console\Domain\Services\ModuleMaker
17
{
18
19
    /**
20
     * @var Filesystem
21
     */
22
    private $filesystem;
23
24
    public function __construct(Filesystem $filesystem)
25
    {
26
        $this->filesystem = $filesystem;
27
    }
28
29
    /**
30
     * @param Module $module
31
     * @throws \Saci\Console\Domain\Exceptions\ModuleAlreadyExists
32
     */
33
    public function make(Module $module)
34
    {
35
36
        if ($this->filesystem->exists($module->getPathModule())) {
37
            throw new ModuleAlreadyExists($module->getName());
38
        }
39
40
        $this->filesystem->mkdir($module->getPaths());
41
    }
42
}