Passed
Push — dev ( b01017...737777 )
by Janko
05:10
created

FleetWrapper::isForeignFleet()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 0
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Ship\Lib;
6
7
use Doctrine\Common\Collections\Collection;
8
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...
9
use Stu\Module\Control\GameControllerInterface;
10
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperFactoryInterface;
11
use Stu\Orm\Entity\Fleet;
12
13
final class FleetWrapper implements FleetWrapperInterface
14
{
15 15
    public function __construct(
16
        private Fleet $fleet,
17
        private SpacecraftWrapperFactoryInterface $spacecraftWrapperFactory,
18
        private GameControllerInterface $game,
19
        private bool $isSingleShips
20 15
    ) {}
21
22 6
    #[Override]
23
    public function get(): Fleet
24
    {
25 6
        return $this->fleet;
26
    }
27
28 6
    #[Override]
29
    public function getLeadWrapper(): ShipWrapperInterface
30
    {
31 6
        return $this->spacecraftWrapperFactory->wrapShip($this->fleet->getLeadShip());
32
    }
33
34 14
    #[Override]
35
    public function getShipWrappers(): Collection
36
    {
37 14
        return $this->spacecraftWrapperFactory->wrapShips($this->fleet->getShips()->toArray());
38
    }
39
40
    #[Override]
41
    public function isForeignFleet(): bool
42
    {
43
        return !$this->isSingleShips && $this->fleet->getUser()->getId() !== $this->game->getUser()->getId();
44
    }
45
}
46