ConvertedResource::getData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 1
cts 1
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace kalanis\Restful;
4
5
6
use kalanis\Restful\Converters\ResourceConverter;
7
8
9
/**
10
 * ConvertedResource
11
 * @package kalanis\Restful
12
 * @template TK of string
13
 * @template TVal of mixed
14
 * @extends Resource<TK, TVal>
15
 */
16 1
class ConvertedResource extends Resource
17
{
18
    /**
19
     * @param ResourceConverter $resourceConverter
20
     * @param array<string|int, mixed> $data
21
     */
22 1
    public function __construct(
23
        private readonly ResourceConverter $resourceConverter,
24
        array                              $data = [],
25
    )
26
    {
27 1
        parent::__construct($data);
28 1
    }
29
30
    /**
31
     * Get parsed resource
32
     * @return array<string|int, mixed>
33
     */
34
    public function getData(): array
35
    {
36 1
        return $this->resourceConverter->convert(parent::getData());
37
    }
38
}
39