TypeMapperServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 7
ccs 2
cts 2
cp 1
crap 2
rs 10
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