Test Failed
Push — main ( 2f8de4...07b5fa )
by Bingo
15:07
created

CommandContextFunctions::currentUserGroups()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 5
dl 0
loc 7
rs 10
c 1
b 1
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Jabe\Engine\Impl\El;
4
5
use Jabe\Engine\Impl\Context\Context;
6
7
class CommandContextFunctions
8
{
9
    public const CURRENT_USER = "currentUser";
10
    public const CURRENT_USER_GROUPS = "currentUserGroups";
11
12
    public static function currentUser(): ?string
13
    {
14
        $commandContext = Context::getCommandContext();
15
        if ($commandContext !== null) {
16
            return $commandContext->getAuthenticatedUserId();
17
        } else {
18
            return null;
19
        }
20
    }
21
22
    public static function currentUserGroups(): array
23
    {
24
        $commandContext = Context::getCommandContext();
25
        if ($commandContext !== null) {
26
            return $commandContext->getAuthenticatedGroupIds();
27
        } else {
28
            return null;
0 ignored issues
show
Bug Best Practice introduced by
The expression return null returns the type null which is incompatible with the type-hinted return array.
Loading history...
29
        }
30
    }
31
}
32