Passed
Push — master ( ffee1f...e53f62 )
by Samuel
03:34
created

ClientReadResult   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 14
c 0
b 0
f 0
dl 0
loc 25
ccs 8
cts 8
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
1
<?php
2
3
namespace App\Domain\Client\Data;
4
5
use App\Domain\Note\Data\NoteData;
6
7
/** Aggregate DTO to store data for client read page */
8
class ClientReadResult extends ClientData
9
{
10
    // Amount of notes for the client to know how many skeleton loaders to display
11
    public ?int $notesAmount = null;
12
13
    // Main note data
14
    public ?NoteData $mainNoteData = null;
15
16
    // If allowed to change personal client values i.e. first name, last name, location, birthdate
17
    public ?string $generalPrivilege = null;
18
    public ?string $clientStatusPrivilege = null;
19
    public ?string $assignedUserPrivilege = null;
20
    public ?string $noteCreationPrivilege = null;
21
22 3
    public function __construct(array $clientResultData = [])
23
    {
24 3
        parent::__construct($clientResultData);
25
26
        // Populate mainNote if set
27 3
        $this->mainNoteData = new NoteData([
28 3
            'id' => $clientResultData['main_note_id'] ?? null,
29 3
            'message' => $clientResultData['note_message'] ?? null,
30 3
            'hidden' => $clientResultData['note_hidden'] ?? null,
31 3
            'user_id' => $clientResultData['note_user_id'] ?? null,
32 3
            'updated_at' => $clientResultData['note_updated_at'] ?? null,
33 3
        ]);
34
    }
35
}
36