Collection   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
c 0
b 0
f 0
dl 0
loc 10
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A toJsonApiArray() 0 5 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Swis\JsonApi\Client;
6
7
use Swis\JsonApi\Client\Interfaces\DataInterface;
8
9
/**
10
 * @template TKey of int
11
 * @template TValue of \Swis\JsonApi\Client\Interfaces\ItemInterface
12
 *
13
 * @extends \Illuminate\Support\Collection<TKey, TValue>
14
 */
15
class Collection extends \Illuminate\Support\Collection implements DataInterface
16
{
17
    /**
18
     * Get the collection of items as a plain json api array.
19
     */
20 8
    public function toJsonApiArray(): array
21
    {
22 8
        return array_map(
23 8
            static fn ($value) => $value instanceof DataInterface ? $value->toJsonApiArray() : $value,
24 8
            $this->items
25 4
        );
26
    }
27
}
28