Audience   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 8
eloc 15
c 2
b 0
f 0
dl 0
loc 50
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getSegmentId() 0 3 1
A setSegmentId() 0 3 1
A setDate() 0 3 1
A getDate() 0 3 1
A setTotal() 0 3 1
A getTotal() 0 3 1
A jsonSerialize() 0 9 2
1
<?php declare(strict_types=1);
2
3
namespace Audiens\AdForm\Entity;
4
5
use DateTime;
6
use JsonSerializable;
7
use stdClass;
8
9
/**
10
 * Class Audience
11
 */
12
class Audience implements JsonSerializable
13
{
14
    /** @var string|null */
15
    protected $segmentId;
16
17
    /** @var DateTime|null */
18
    protected $date;
19
20
    /** @var int|null */
21
    protected $total;
22
23
    public function getSegmentId(): ?string
24
    {
25
        return $this->segmentId;
26
    }
27
28
    public function setSegmentId(string $segmentId): void
29
    {
30
        $this->segmentId = $segmentId;
31
    }
32
33
    public function getDate(): ?DateTime
34
    {
35
        return $this->date;
36
    }
37
38
    public function setDate(DateTime $date): void
39
    {
40
        $this->date = $date;
41
    }
42
43
    public function getTotal(): ?int
44
    {
45
        return $this->total;
46
    }
47
48
    public function setTotal(int $total): void
49
    {
50
        $this->total = $total;
51
    }
52
53
    public function jsonSerialize()
54
    {
55
        $obj = new stdClass();
56
57
        $obj->segmentId = $this->segmentId;
58
        $obj->date = $this->date ? $this->date->format('c'): null;
59
        $obj->total = $this->total;
60
61
        return $obj;
62
    }
63
}
64