TypeMapperServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 16
ccs 2
cts 2
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Swis\JsonApi\Client\Providers;
6
7
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
8
use Swis\JsonApi\Client\Interfaces\TypeMapperInterface;
9
10
class TypeMapperServiceProvider extends BaseServiceProvider
11
{
12
    /**
13
     * A list of class names implementing \Swis\JsonApi\Client\Interfaces\ItemInterface.
14
     *
15
     * @var string[]
16
     */
17
    protected $items = [];
18
19
    public function boot(TypeMapperInterface $typeMapper)
20
    {
21
        foreach ($this->items as $class) {
22 4
            /** @var \Swis\JsonApi\Client\Interfaces\ItemInterface $item */
23
            $item = $this->app->make($class);
24 4
25
            $typeMapper->setMapping($item->getType(), $class);
26 4
        }
27
    }
28
}
29