SQLiteRoleRepository::addModuleToRole()   A
last analyzed

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 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace ProyectoTAU\TAU\Module\Administration\Role\Infrastructure;
4
5
use ProyectoTAU\TAU\Common\SQLiteRepository;
6
use ProyectoTAU\TAU\Module\Administration\Module\Domain\Module;
7
use ProyectoTAU\TAU\Module\Administration\Role\Domain\Role;
8
use ProyectoTAU\TAU\Module\Administration\Group\Domain\Group;
9
use ProyectoTAU\TAU\Module\Administration\Role\Domain\RoleRepository;
10
11
class SQLiteRoleRepository implements RoleRepository
12
{
13 17
    public function clear(): void
14
    {
15 17
        SQLiteRepository::getInstance()->clearRole();
16 17
    }
17
18 17
    public function create(Role $role): void
19
    {
20 17
        SQLiteRepository::getInstance()->createRole($role);
21 17
    }
22
23 13
    public function read($id): Role
24
    {
25 13
        return SQLiteRepository::getInstance()->readRole($id);
26
    }
27
28 1
    public function readAll(): array
29
    {
30 1
        return SQLiteRepository::getInstance()->readAllRoles();
0 ignored issues
show
Bug introduced by
The method readAllRoles() does not exist on ProyectoTAU\TAU\Common\Repository. Did you maybe mean readAllUsers()? ( Ignorable by Annotation )

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

30
        return SQLiteRepository::getInstance()->/** @scrutinizer ignore-call */ readAllRoles();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
31
    }
32
33 1
    public function update($id, $name, $desc): void
34
    {
35 1
        SQLiteRepository::getInstance()->updateRole($id, $name, $desc);
36 1
    }
37
38 1
    public function delete($id): void
39
    {
40 1
        SQLiteRepository::getInstance()->deleteRole($id);
41 1
    }
42
43 3
    public function addGroupToRole(Group $group, Role $role): void
44
    {
45 3
        SQLiteRepository::getInstance()->addGroupToRole($group, $role);
46 3
    }
47
48 1
    public function removeGroupFromRole(Group $group, Role $role): void
49
    {
50 1
        SQLiteRepository::getInstance()->removeGroupFromRole($group, $role);
51 1
    }
52
53 1
    public function getGroupsFromRole(Role $role): array
54
    {
55 1
        return SQLiteRepository::getInstance()->getGroupsFromRole($role);
56
    }
57
58 3
    public function addModuleToRole(Module $module, Role $role): void
59
    {
60 3
        SQLiteRepository::getInstance()->addModuleToRole($module, $role);
61 3
    }
62
63 1
    public function removeModuleFromRole(Module $module, Role $role): void
64
    {
65 1
        SQLiteRepository::getInstance()->removeModuleFromRole($module, $role);
66 1
    }
67
68 2
    public function getModulesFromRole(Role $role): array
69
    {
70 2
        return SQLiteRepository::getInstance()->getModulesFromRole($role);
71
    }
72
}
73