fields[] = [ 'name' => $name, 'value' => $value, ]; return $this; } public function toPayload(): array { $payload = [ 'embeds' => [ [ 'title' => $this->title, 'description' => $this->description, 'color' => $this->color, 'fields' => $this->addTimestampToFields($this->fields), ], ], ]; if ($this->isCritical) { $payload['content'] = '@here'; } return $payload; } private function addTimestampToFields(array $fields): array { $fields[] = [ 'name' => 'Time', 'value' => 'timestamp.':R>', ]; return $fields; } }