public function toArray()
{
$issue = [];
foreach (static::$properties as $property) {
switch ($property) {
case 'id':
$issue['number'] = $this->{$property};
break;
case 'labels':
$issue['labels'] = $this->{$property};
break;
case 'author':
$issue['user'] = $this->{$property}->username;
break;
case 'assignee':
if (null !== $this->{$property}) {
$issue['assignee'] = $this->{$property}->username;
} else {
$issue['assignee'] = null;
}
break;
case 'description':
$issue['body'] = $this->{$property};
break;
case 'created_at':
case 'updated_at':
$issue[$property] = new \DateTime($this->{$property});
break;
case 'milestone':
$issue['milestone'] = $this->{$property};
break;
default:
$issue[$property] = $this->{$property};
}
$issue['url'] = '';
$issue['pull_request'] = false;
}
return $issue;
}