Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
80.00% covered (warning)
80.00%
16 / 20
63.64% covered (warning)
63.64%
7 / 11
CRAP
0.00% covered (danger)
0.00%
0 / 1
LogJournal
80.00% covered (warning)
80.00%
16 / 20
63.64% covered (warning)
63.64%
7 / 11
11.97
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
1
 getId
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getCollectivity
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getUserFullName
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getUserEmail
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getDate
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getAction
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getSubjectType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getSubjectId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getSubjectName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 isDeleted
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Domain\Reporting\Model;
4
5use App\Domain\Reporting\Dictionary\LogJournalActionDictionary;
6use App\Domain\User\Model\Collectivity;
7use Ramsey\Uuid\Uuid;
8
9/**
10 * Contain all user actions (Create, update, delete, login, and update user account).
11 */
12class LogJournal
13{
14    /**
15     * @var Uuid
16     */
17    private $id;
18
19    /**
20     * @var Collectivity
21     */
22    private $collectivity;
23
24    /**
25     * @var string
26     */
27    private $userFullName;
28
29    /**
30     * @var string
31     */
32    private $userEmail;
33
34    /**
35     * @var \DateTimeImmutable
36     */
37    private $date;
38
39    /**
40     * @see LogJournalActionDictionary
41     *
42     * @var string
43     */
44    private $action;
45
46    /**
47     * @see LogJournalSubjectDictionary
48     *
49     * @var string
50     */
51    private $subjectType;
52
53    /**
54     * Can be null on delete action.
55     *
56     * @var string
57     */
58    private $subjectId;
59
60    /**
61     * @var string
62     */
63    private $subjectName;
64
65    /**
66     * @var bool
67     */
68    private $isDeleted;
69
70    public function __construct(
71        Collectivity $collectivity,
72        string $userFullName,
73        string $userEmail,
74        string $action,
75        string $subjectType,
76        string $subjectId,
77        string $subjectName,
78    ) {
79        $this->id           = Uuid::uuid4();
80        $this->collectivity = $collectivity;
81        $this->userFullName = $userFullName;
82        $this->userEmail    = $userEmail;
83        $this->date         = new \DateTimeImmutable();
84        $this->action       = $action;
85        $this->subjectType  = $subjectType;
86        $this->subjectId    = $subjectId;
87        $this->subjectName  = $subjectName;
88        $this->isDeleted    = false;
89    }
90
91    public function getId(): Uuid
92    {
93        return $this->id;
94    }
95
96    public function getCollectivity(): Collectivity
97    {
98        return $this->collectivity;
99    }
100
101    public function getUserFullName(): string
102    {
103        return $this->userFullName;
104    }
105
106    public function getUserEmail(): string
107    {
108        return $this->userEmail;
109    }
110
111    public function getDate(): \DateTimeImmutable
112    {
113        return $this->date;
114    }
115
116    public function getAction(): string
117    {
118        return $this->action;
119    }
120
121    public function getSubjectType(): string
122    {
123        return $this->subjectType;
124    }
125
126    public function getSubjectId(): string
127    {
128        return $this->subjectId;
129    }
130
131    public function getSubjectName(): string
132    {
133        return $this->subjectName;
134    }
135
136    public function isDeleted(): bool
137    {
138        return $this->isDeleted;
139    }
140}