Completed
Push — master ( fcdb68...d209bc )
by Vladimir
02:46
created

BaseManager   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
ccs 3
cts 6
cp 0.5
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setLogger() 0 4 1
1
<?php
2
3
namespace allejo\stakx\Manager;
4
5
use allejo\stakx\Core\StakxLogger;
6
use allejo\stakx\System\Filesystem;
7
use Psr\Log\LoggerAwareInterface;
8
use Psr\Log\LoggerInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
abstract class BaseManager implements LoggerAwareInterface
12
{
13
    /**
14
     * @var StakxLogger
15
     */
16
    protected $output;
17
18
    /**
19
     * @var Filesystem
20
     */
21
    protected $fs;
22
23 4
    public function __construct ()
24
    {
25 4
        $this->fs = new Filesystem();
26 4
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function setLogger(LoggerInterface $logger)
32
    {
33
        $this->output = $logger;
0 ignored issues
show
Documentation Bug introduced by
$logger is of type object<Psr\Log\LoggerInterface>, but the property $output was declared to be of type object<allejo\stakx\Core\StakxLogger>. 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...
34
    }
35
}