NoteResultData   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A jsonSerialize() 0 7 1
1
<?php
2
3
namespace App\Module\Note\List\Data;
4
5
use App\Module\Note\Data\NoteData;
6
7
/**
8
 * Note with user and client full name and privilege.
9
 */
10
class NoteResultData extends NoteData
11
{
12
    public ?string $userFullName;
13
    public ?string $clientFullName;
14
    public ?bool $isClientMessage = false;
15
16
    // Populated in NoteUserRightSetter
17
    public string $privilege; // json_encode automatically takes $enum->value
18
19 8
    public function __construct(array $noteValues = [])
20
    {
21 8
        parent::__construct($noteValues);
22
23 8
        $this->userFullName = $noteValues['user_full_name'] ?? null;
24 8
        $this->clientFullName = $noteValues['client_full_name'] ?? null;
25
    }
26
27 8
    public function jsonSerialize(): array
28
    {
29 8
        return array_merge(parent::jsonSerialize(), [
30 8
            'userFullName' => $this->userFullName,
31 8
            'clientFullName' => $this->clientFullName,
32 8
            'privilege' => $this->privilege,
33 8
            'isClientMessage' => (int)$this->isClientMessage,
34 8
        ]);
35
    }
36
}
37