Passed
Push — dev ( 0aa780...31f66c )
by Janko
11:20
created

ColonyMember::getUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Stu\Lib\Interaction\Member;
4
5
use Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Stu\Lib\Interaction\InteractionCheckType;
7
use Stu\Module\Ship\Lib\TholianWebUtilInterface;
8
use Stu\Orm\Entity\ColonyInterface;
9
use Stu\Orm\Entity\MapInterface;
10
use Stu\Orm\Entity\StarSystemMapInterface;
11
use Stu\Orm\Entity\UserInterface;
12
13
class ColonyMember implements InteractionMemberInterface
14
{
15 4
    public function __construct(
16
        private TholianWebUtilInterface $tholianWebUtil,
17
        private ColonyInterface $colony
18 4
    ) {}
19
20
    #[Override]
21
    public function get(): ColonyInterface
22
    {
23
        return $this->colony;
24
    }
25
26 2
    #[Override]
27
    public function canAccess(
28
        InteractionMemberInterface $other,
29
        callable $shouldCheck
30
    ): ?InteractionCheckType {
31 2
        return null;
32
    }
33
34 2
    #[Override]
35
    public function canBeAccessedFrom(
36
        InteractionMemberInterface $other,
37
        bool $isFriend,
38
        callable $shouldCheck
39
    ): ?InteractionCheckType {
40
41
        if (
42 2
            $shouldCheck(InteractionCheckType::EXPECT_TARGET_ALSO_IN_FINISHED_WEB)
43 2
            && $this->tholianWebUtil->isTargetOutsideFinishedTholianWeb($other->get(), $this->colony)
44
        ) {
45
            return InteractionCheckType::EXPECT_TARGET_ALSO_IN_FINISHED_WEB;
46
        }
47
48 2
        return null;
49
    }
50
51 4
    #[Override]
52
    public function getLocation(): MapInterface|StarSystemMapInterface
53
    {
54 4
        return $this->colony->getLocation();
55
    }
56
57 4
    #[Override]
58
    public function getUser(): ?UserInterface
59
    {
60 4
        return $this->colony->getUser();
61
    }
62
}
63