public function serialize() { $fields = ['project' => ['id' => $this->project->id], 'issuetype' => $this->issueType, 'components' => is_array($this->components) ? array_values($this->components) : []]; if ($this->description) { $fields['description'] = $this->description; } if ($this->summary) { $fields['summary'] = $this->summary; } foreach ($this->issueType->getCustomFieldsMap() as $name => $id) { if (isset($this->customFields[$name])) { $fields['customfield_' . $id] = $this->customFields[$name]; } } return ['fields' => $fields]; }