Passed
Push — master ( fad3cd...8c9440 )
by Michael
02:31
created

ClassProcessor   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 17 4
1
<?php
2
declare(strict_types = 1);
3
4
namespace Mikemirten\Component\JsonApi\Mapper\Definition\ConfigurationProcessor;
5
6
use Mikemirten\Component\JsonApi\Mapper\Definition\Definition;
7
8
/**
9
 * Processor of configuration of class
10
 *
11
 * @package Mikemirten\Component\JsonApi\Mapper\Definition\ConfigurationProcessor
12
 */
13
class ClassProcessor extends AbstractProcessor
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18 2
    public function process(array $config, Definition $definition)
19
    {
20 2
        if (isset($config['type'])) {
21 1
            $definition->setType($config['type']);
22
        }
23
24 2
        if (! isset($config['links'])) {
25 1
            return;
26
        }
27
28 1
        foreach ($config['links'] as $linkName => $linkData)
29
        {
30 1
            $link = $this->createLink($linkName, $linkData);
31
32 1
            $definition->addLink($link);
33
        }
34
    }
35
}