Test Failed
Push — main ( 2036f5...f2d0d3 )
by Proyecto
07:50
created

InMemoryModuleRepository   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 8
c 1
b 0
f 0
dl 0
loc 35
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A read() 0 3 1
A create() 0 3 1
A delete() 0 3 1
A addRoleToModule() 0 3 1
A update() 0 3 1
A getRolesFromModule() 0 3 1
A removeRoleFromModule() 0 3 1
1
<?php
2
3
namespace ProyectoTAU\TAU\Module\Administration\Module\Infrastructure;
4
5
use ProyectoTAU\TAU\Common\InMemoryRepository;
6
use ProyectoTAU\TAU\Module\Administration\Role\Domain\Role;
7
use ProyectoTAU\TAU\Module\Administration\Module\Domain\Module;
8
use ProyectoTAU\TAU\Module\Administration\Module\Domain\ModuleRepository;
9
10
class InMemoryModuleRepository implements ModuleRepository
11
{
12
    public function create(Module $module): void
13
    {
14
        InMemoryRepository::getInstance()->createModule($module);
15
    }
16
17
    public function read($id): Module
18
    {
19
        return InMemoryRepository::getInstance()->readModule($id);
20
    }
21
22
    public function update($id, $name, $desc): void
23
    {
24
        InMemoryRepository::getInstance()->updateModule($id, $name, $desc);
25
    }
26
27
    public function delete($id): void
28
    {
29
        InMemoryRepository::getInstance()->deleteModule($id);
30
    }
31
32
    public function addRoleToModule(Role $role, Module $module): void
33
    {
34
        InMemoryRepository::getInstance()->addRoleToModule($role, $module);
35
    }
36
37
    public function removeRoleFromModule(Role $role, Module $module): void
38
    {
39
        InMemoryRepository::getInstance()->removeRoleFromModule($role, $module);
40
    }
41
42
    public function getRolesFromModule(Module $module): array
43
    {
44
        return InMemoryRepository::getInstance()->getRolesFromModule($module);
45
    }
46
}
47