| Total Complexity | 8 |
| Total Lines | 101 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class Event implements JsonSerializable |
||
| 10 | { |
||
| 11 | use Jsonable; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var array |
||
| 15 | */ |
||
| 16 | protected $properties; |
||
| 17 | /** |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | protected $email; |
||
| 21 | /** |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | protected $action; |
||
| 25 | /** |
||
| 26 | * @var DateTime |
||
| 27 | */ |
||
| 28 | protected $occurred_at; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param string $key |
||
| 32 | * @param string $value |
||
| 33 | * |
||
| 34 | * @return Event |
||
| 35 | */ |
||
| 36 | 2 | public function addProperty(string $key, string $value): self |
|
| 37 | { |
||
| 38 | 2 | $this->properties[$key] = $value; |
|
| 39 | |||
| 40 | 2 | return $this; |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @param string $key |
||
| 45 | * |
||
| 46 | * @return Event |
||
| 47 | */ |
||
| 48 | 1 | public function removeProperty(string $key): self |
|
| 49 | { |
||
| 50 | 1 | if (!empty($this->properties[$key])) { |
|
| 51 | 1 | unset($this->properties[$key]); |
|
| 52 | } |
||
| 53 | |||
| 54 | 1 | return $this; |
|
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @param array $properties |
||
| 59 | * |
||
| 60 | * @return Event |
||
| 61 | */ |
||
| 62 | 1 | public function setProperties(array $properties): self |
|
| 63 | { |
||
| 64 | 1 | $this->properties = $properties; |
|
| 65 | |||
| 66 | 1 | return $this; |
|
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @param string $email |
||
| 71 | * |
||
| 72 | * @return Event |
||
| 73 | */ |
||
| 74 | 3 | public function setEmail(string $email): self |
|
| 75 | { |
||
| 76 | 3 | $this->email = $email; |
|
| 77 | |||
| 78 | 3 | return $this; |
|
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * @param string $action |
||
| 83 | * |
||
| 84 | * @return Event |
||
| 85 | */ |
||
| 86 | 3 | public function setAction(string $action): self |
|
| 91 | } |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @param DateTime $occurredAt |
||
| 95 | * |
||
| 96 | * @return Event |
||
| 97 | */ |
||
| 98 | 2 | public function setOccurredAt(DateTime $occurredAt): self |
|
| 103 | } |
||
| 104 | |||
| 105 | 2 | public function toDrip(): array |
|
| 110 | ], |
||
| 111 | ]; |
||
| 112 | } |
||
| 114 |