BookWithAuthor   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 5
cts 5
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LibraryCatalog\Controller\V1\Transformer;
6
7
use LibraryCatalog\Controller\TransformerException;
8
9
class BookWithAuthor extends Book
10
{
11
    /**
12
     * @param $data
13
     * @return array
14
     * @throws TransformerException
15
     */
16 2
    public function transform($data): array
17
    {
18 2
        $res = parent::transform($data);
19
20 2
        if (isset($data->author)) {
21 1
            $res['author'] = (new Author())->transform($data->author);
22
        }
23
24 2
        return $res;
25
    }
26
}
27