ListResponse   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 23
ccs 8
cts 8
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A from() 0 8 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace InShore\Bookwhen\Responses\Attachments;
6
7
use InShore\Bookwhen\Contracts\ResponseContract;
8
use InShore\Bookwhen\Responses\Attachments\RetrieveResponse;
9
10
//use InShore\Bookwhen\Testing\Responses\Concerns\Fakeable;
11
12
/**
13
 * @implements ResponseContract<array{object: string, data: array<int, array{id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>}>
14
 */
15
final class ListResponse implements ResponseContract
16
{
17
    /**
18
     * @param  array<int, RetrieveResponse>  $data
19
     */
20 1
    private function __construct(
21
        public readonly array $data
22
    ) {
23 1
    }
24
25
    /**
26
     * Acts as static factory, and returns a new Response instance.
27
     *
28
     * @param  array{data: array<int, array{event_id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>}  $attributes
0 ignored issues
show
Documentation Bug introduced by
The doc comment array{data: array<int, a..., mixed>|string|null}>} at position 42 could not be parsed: Unknown type name 'array-key' at position 42 in array{data: array<int, array{event_id: string, object: string, created_at: int, bytes: int, filename: string, purpose: string, status: string, status_details: array<array-key, mixed>|string|null}>}.
Loading history...
29
     */
30 1
    public static function from(array $attributes): self
31
    {
32 1
        $data = array_map(fn (array $result): RetrieveResponse => RetrieveResponse::from(
33 1
            $result
34 1
        ), $attributes['data']);
35
36 1
        return new self(
37 1
            $data,
38 1
        );
39
    }
40
}
41