Completed
Push — dev ( 51753e...214409 )
by De Cramer
02:51
created

AbstractConnectionCommand   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 33
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 18 1
1
<?php
2
3
namespace eXpansion\Bundle\AdminChat\ChatCommand;
4
5
use eXpansion\Framework\AdminGroups\Helpers\AdminGroups;
6
use eXpansion\Framework\AdminGroups\Model\AbstractAdminChatCommand;
7
use eXpansion\Framework\Core\Helpers\ChatNotification;
8
use eXpansion\Framework\Core\Storage\PlayerStorage;
9
use Maniaplanet\DedicatedServer\Connection;
10
use Monolog\Logger;
11
use Psr\Log\LoggerInterface;
12
13
/**
14
 * Class Restart
15
 *
16
 * @package eXpansion\Bundle\AdminChat\ChatCommand;
17
 * @author oliver de Cramer <[email protected]>
18
 */
19
abstract class AbstractConnectionCommand extends AbstractAdminChatCommand
20
{
21
    /** @var Connection  */
22
    protected $connection;
23
24
    /** @var ChatNotification  */
25
    protected $chatNotification;
26
27
    /** @var PlayerStorage  */
28
    protected $playerStorage;
29
30
    /** @var Logger */
31
    protected $logger;
32
33 2
    public function __construct(
34
        $command,
35
        $permission,
36
        array $aliases = [],
37
        AdminGroups $adminGroupsHelper,
38
        Connection $connection,
39
        ChatNotification $chatNotification,
40
        PlayerStorage $playerStorage,
41
        LoggerInterface $logger
42
    )
43
    {
44 2
        parent::__construct($command, $permission, $aliases, $adminGroupsHelper);
45
46 2
        $this->connection = $connection;
47 2
        $this->chatNotification = $chatNotification;
48 2
        $this->playerStorage = $playerStorage;
49 2
        $this->logger = $logger;
0 ignored issues
show
Documentation Bug introduced by
$logger is of type object<Psr\Log\LoggerInterface>, but the property $logger was declared to be of type object<Monolog\Logger>. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
50 2
    }
51
}
52