Passed
Branch dev (1955a2)
by Janko
31:39 queued 24:20
created

GetTargetWrapperTrait::getTargetWrapper()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.7462

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 2
eloc 6
nc 2
nop 4
dl 0
loc 14
ccs 3
cts 7
cp 0.4286
crap 2.7462
rs 10
c 2
b 1
f 0
1
<?php
2
3
namespace Stu\Component\Spacecraft\System\Control;
4
5
use Stu\Module\Control\GameControllerInterface;
0 ignored issues
show
Bug introduced by
The type Stu\Module\Control\GameControllerInterface 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\Module\Spacecraft\Lib\SpacecraftLoaderInterface;
7
use Stu\Module\Spacecraft\Lib\SpacecraftWrapperInterface;
8
use Stu\Orm\Entity\User;
9
10
trait GetTargetWrapperTrait
11
{
12
    /** @param SpacecraftLoaderInterface<SpacecraftWrapperInterface> $spacecraftLoader*/
13 3
    protected function getTargetWrapper(
14
        SpacecraftWrapperInterface|int $target,
15
        bool $allowUplink,
16
        SpacecraftLoaderInterface $spacecraftLoader,
17
        GameControllerInterface $game
18
    ): SpacecraftWrapperInterface {
19 3
        if ($target instanceof SpacecraftWrapperInterface) {
20 3
            return $target;
21
        }
22
23
        return $spacecraftLoader->getWrapperByIdAndUser(
24
            $target,
25
            $game->getUser()->getId(),
26
            $allowUplink
27
        );
28
    }
29
}
30