Completed
Push — 1.0 ( 678007...4c5066 )
by Vladimir
21:50
created

DriverServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 20
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Drivers;
6
7
use TheCodingMachine\Discovery\Discovery;
8
use League\Container\ServiceProvider\AbstractServiceProvider;
9
10
class DriverServiceProvider extends AbstractServiceProvider
11
{
12
    protected $provides = [
13
        DriverManager::class,
14
    ];
15
16
    /**
17
     * Use the register method to register items with the container via the
18
     * protected $this->container property or the `getContainer` method
19
     * from the ContainerAwareTrait.
20
     *
21
     * @return void
22
     */
23 1
    public function register(): void
24
    {
25 1
        $manager = new DriverManager($this->getContainer(), Discovery::getInstance());
0 ignored issues
show
Compatibility introduced by
$this->getContainer() of type object<League\Container\ContainerInterface> is not a sub-type of object<FondBot\Application\Container>. It seems like you assume a concrete implementation of the interface League\Container\ContainerInterface to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
26
27 1
        $this->getContainer()->add(DriverManager::class, $manager);
28 1
    }
29
}
30