Passed
Push — dev ( 842324...d0c170 )
by Janko
14:41
created

ShipTakeoverHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Component\Player\Deletion\Handler;
6
7
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...
8
use Stu\Module\Spacecraft\Lib\Interaction\ShipTakeoverManagerInterface;
9
use Stu\Orm\Entity\UserInterface;
10
use Stu\Orm\Repository\ShipTakeoverRepositoryInterface;
11
12
final class ShipTakeoverHandler implements PlayerDeletionHandlerInterface
13
{
14 1
    public function __construct(
15
        private ShipTakeoverRepositoryInterface $shipTakeoverRepository,
16
        private ShipTakeoverManagerInterface $shipTakeoverManager
17 1
    ) {}
18
19
    #[Override]
20
    public function delete(UserInterface $user): void
21
    {
22
        foreach ($this->shipTakeoverRepository->getByTargetOwner($user) as $shipTakeover) {
23
24
            $this->shipTakeoverManager->cancelTakeover(
25
                $shipTakeover,
26
                ', da der Spieler des Ziels gelöscht wurde'
27
            );
28
        }
29
    }
30
}
31