Completed
Branch 1.x (2c7718)
by Akihito
01:38
created

ResourceModule   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 26
ccs 9
cts 9
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 6 1
A __construct() 0 5 1
1
<?php
2
/**
3
 * This file is part of the BEAR.Resource package.
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace BEAR\Resource\Module;
8
9
use BEAR\Resource\Annotation\AppName;
10
use Ray\Di\AbstractModule;
11
12
class ResourceModule extends AbstractModule
13
{
14
    /**
15
     * @var string
16
     */
17
    private $appName;
18
19
    /**
20
     * @param string $appName
21
     */
22 47
    public function __construct($appName)
23
    {
24 47
        $this->appName = $appName;
25 47
        parent::__construct();
26 47
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31 47
    protected function configure()
32
    {
33 47
        $this->bind()->annotatedWith(AppName::class)->toInstance($this->appName);
34 47
        $this->install(new ResourceClientModule);
0 ignored issues
show
Documentation introduced by
new \BEAR\Resource\Module\ResourceClientModule() is of type object<BEAR\Resource\Module\ResourceClientModule>, but the function expects a object<self>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
35 47
        $this->install(new EmbedResourceModule);
0 ignored issues
show
Documentation introduced by
new \BEAR\Resource\Module\EmbedResourceModule() is of type object<BEAR\Resource\Module\EmbedResourceModule>, but the function expects a object<self>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
36 47
    }
37
}
38