Completed
Push — master ( 5523da...313d5d )
by max
12:42
created

MailLogEntry   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 57
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B populate() 0 14 6
1
<?php
2
3
namespace T4web\Mail\Domain\MailLogEntry;
4
5
use T4webDomain\Entity;
6
7
class MailLogEntry extends Entity
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $mailFrom;
13
14
    /**
15
     * @var string
16
     */
17
    protected $mailTo;
18
19
    /**
20
     * @var string
21
     */
22
    protected $subject;
23
24
    /**
25
     * @var int
26
     */
27
    protected $layoutId;
28
29
    /**
30
     * @var int
31
     */
32
    protected $templateId;
33
34
    /**
35
     * @var string
36
     */
37
    protected $body;
38
39
    /**
40
     * @var array
41
     */
42
    protected $calculatedVars;
43
44
    /**
45
     * @var string
46
     */
47
    protected $createdDt;
48
49
    public function populate(array $array = [])
50
    {
51
        if ($this->id === null && empty($array['id'])) {
52
            if (empty($array['createdDt'])) {
53
                $array['createdDt'] = date('Y-m-d H:i:s.u');
54
            }
55
        }
56
57
        if (isset($array['calculatedVars']) && is_array($array['calculatedVars'])) {
58
            $array['calculatedVars'] = json_encode($array['calculatedVars']);
59
        }
60
61
        return parent::populate($array);
62
    }
63
}
64