target = new campaign(); } public function set_type(campaign_type $type) : self { $this->target->type = $type; if ($this->target->is_complete()) { $this->complete(); } return $this; } public function set_message(message $message) : self { if (!$message->has_id()) { throw new \exception('Message to set for campaign must has ID.'); } $this->target->message = $message; if ($this->target->is_complete()) { $this->complete(); } return $this; } public function set_group(group $group) : self { $this->target->group = $group; if ($this->target->is_complete()) { $this->complete(); } return $this; } public function set_test(bool $test = true) : self { $this->target->test = $test; if ($this->target->is_complete()) { $this->complete(); } return $this; } }