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

ShipTakeoverHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 28.57%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 15
ccs 2
cts 7
cp 0.2857
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A delete() 0 8 2
A __construct() 0 4 1
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