ClientReadResult   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

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