Passed
Push — main ( 21c65b...2786e4 )
by Proyecto
08:22
created

InMemoryModuleRepository::readAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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 22
    public function clear(): void
13
    {
14 22
        InMemoryRepository::getInstance()->clearModule();
15 22
    }
16
17 22
    public function create(Module $module): void
18
    {
19 22
        InMemoryRepository::getInstance()->createModule(clone $module);
20 22
    }
21
22 16
    public function read($id): Module
23
    {
24 16
        return InMemoryRepository::getInstance()->readModule($id);
25
    }
26
27 2
    public function readAll(): array
28
    {
29 2
        return InMemoryRepository::getInstance()->readAllModules();
0 ignored issues
show
Bug introduced by
The method readAllModules() does not exist on ProyectoTAU\TAU\Common\Repository. Since it exists in all sub-types, consider adding an abstract or default implementation to ProyectoTAU\TAU\Common\Repository. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
        return InMemoryRepository::getInstance()->/** @scrutinizer ignore-call */ readAllModules();
Loading history...
30
    }
31
32 2
    public function update($id, $name, $desc): void
33
    {
34 2
        InMemoryRepository::getInstance()->updateModule($id, $name, $desc);
35 2
    }
36
37 2
    public function delete($id): void
38
    {
39 2
        InMemoryRepository::getInstance()->deleteModule($id);
40 2
    }
41
42 6
    public function addRoleToModule(Role $role, Module $module): void
43
    {
44 6
        InMemoryRepository::getInstance()->addRoleToModule($role, $module);
45 6
    }
46
47 2
    public function removeRoleFromModule(Role $role, Module $module): void
48
    {
49 2
        InMemoryRepository::getInstance()->removeRoleFromModule($role, $module);
50 2
    }
51
52 4
    public function getRolesFromModule(Module $module): array
53
    {
54 4
        return InMemoryRepository::getInstance()->getRolesFromModule($module);
55
    }
56
}
57