FirebaseModule   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 19
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A configure() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Piotzkhider\FirebaseModule;
6
7
use Kreait\Firebase;
8
use Piotzkhider\FirebaseModule\Annotation\Credentials;
9
use Ray\Di\AbstractModule;
10
use Ray\Di\Scope;
11
12
class FirebaseModule extends AbstractModule
13
{
14
    /**
15
     * @var mixed
16
     */
17
    private $credentials;
18
19 5
    public function __construct($credentials, AbstractModule $module = null)
20
    {
21 5
        $this->credentials = $credentials;
22 5
        parent::__construct($module);
0 ignored issues
show
Bug introduced by
It seems like $module defined by parameter $module on line 19 can also be of type object<Ray\Di\AbstractModule>; however, Ray\Di\AbstractModule::__construct() does only seem to accept null|object<self>, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
23 5
    }
24
25 5
    protected function configure(): void
26
    {
27 5
        $this->bind()->annotatedWith(Credentials::class)->toInstance($this->credentials);
28 5
        $this->bind(Firebase::class)->toProvider(FirebaseProvider::class)->in(Scope::SINGLETON);
29 5
    }
30
}
31