public function transform($task) { return ['subject' => $this->_getTitle($task), 'status_id' => map_status($task['status']['name'], strtolower($task['vendor']), $this->vendor), 'parent_issue_id' => config('redmine.import.parent_task'), 'priority_id' => map_prio($task['priority']['id'], strtolower($task['vendor']), $this->vendor), 'assigned_to_id' => map_user($task['assigned_to']['name'], strtolower($task['vendor']), $this->vendor), 'watcher_user_ids' => config('redmine.import.watchers'), 'description' => $task['link'], 'due_date' => $this->_getTaskDueDate($task), 'custom_fields' => $this->_getCustomFields($task)]; }
public function transform($task) { return ['title' => $this->_getTitle($task), 'body' => $this->_getBody($task), 'assignee' => map_user($task['assigned_to']['name'], strtolower($task['vendor']), $this->vendor), 'labels' => $this->_getLabels($task)]; }
/** * Prepares an array of parameters to be passed to create a new issue. * * @param $task * @return array */ private function _prepareCreationParameters($task) { $parameters = []; $customFields = []; foreach (config('github.custom_fields') as $field) { $customFields[] = str_replace('{TASK_ID}', (int) $task['id'], $field); } $title = ["{ORIGIN}" => $task['vendor'], "{TASK_ID}" => $task['id'], "{TASK_TITLE}" => $task['title']]; $title = str_replace(array_keys($title), $title, config('github.import.title_template')); if (!$task['due_date']) { $due_date = null; } elseif (is_date_sooner($task['due_date'])) { $due_date = null; } else { $due_date = $task['due_date']->format('Y/m/d'); } $parameters['subject'] = $title; $parameters['status_id'] = map_status($task['status']['name'], strtolower($task['vendor']), $this->vendor); $parameters['parent_issue_id'] = config('github.import.parent_task'); $parameters['priority_id'] = map_prio($task['priority']['id'], strtolower($task['vendor']), $this->vendor); $parameters['assigned_to_id'] = map_user($task['assigned_to']['name'], strtolower($task['vendor']), $this->vendor); $parameters['watcher_user_ids'] = config('github.import.watchers'); $parameters['description'] = $task['link']; $parameters['due_date'] = $due_date; $parameters['custom_fields'] = $customFields; return $parameters; }