Completed
Pull Request — master (#126)
by Phil
02:35
created

AbstractServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A provides() 0 4 1
A withSignature() 0 6 1
A getSignature() 0 4 2
1
<?php declare(strict_types=1);
2
3
namespace League\Container\ServiceProvider;
4
5
use League\Container\ContainerAwareTrait;
6
7
abstract class AbstractServiceProvider implements ServiceProviderInterface
8
{
9
    use ContainerAwareTrait;
10
11
    /**
12
     * @var array
13
     */
14
    protected $provides = [];
15
16
    /**
17
     * @var string
18
     */
19
    protected $signature;
20
21
    /**
22
     * {@inheritdoc}
23
     */
24 9
    public function provides(string $alias): bool
25
    {
26 9
        return (in_array($alias, $this->provides));
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 3
    public function withSignature(string $signature): ServiceProviderInterface
33
    {
34 3
        $this->signature = $signature;
35
36 3
        return $this;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42 3
    public function getSignature(): string
43
    {
44 3
        return (is_null($this->signature)) ? get_class($this) : $this->signature;
45
    }
46
}
47