51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\CsvController;
|
|
|
|
class CsvDataInit
|
|
{
|
|
public function __construct()
|
|
{
|
|
|
|
}
|
|
|
|
private function get_issue_labels(array $issue)
|
|
{
|
|
$labels = '';
|
|
foreach ($issue['labels'] as $label) {
|
|
$labels .= $label['name'] . ',';
|
|
}
|
|
return $labels;
|
|
}
|
|
|
|
function handle_labels($array, $issue_labels){
|
|
foreach ($issue_labels as $key => $label) {
|
|
if (strpos($label['name'],'Kind') !== false) {
|
|
$array['Kind'] = $label['name'];
|
|
}
|
|
if (strpos($label['name'],'RequestBy') !== false) {
|
|
$array['Request By'] = $label['name'];
|
|
}
|
|
if (strpos($label['name'],'Priority') !== false) {
|
|
$array['Priority'] = $label['name'];
|
|
}
|
|
}
|
|
return $array;
|
|
}
|
|
|
|
function initialize_csv_data(array $issue){
|
|
return array(
|
|
'Progetto' => $issue['repository']['name'],
|
|
'#' => $issue['number'],
|
|
'Titolo' => $issue['title'],
|
|
'URL' => $issue['html_url'],
|
|
'Aperto_il' => $issue['created_at'],
|
|
'Chiuso_il' => $issue['closed_at'],
|
|
'Etichette' => $this->get_issue_labels($issue),
|
|
'Kind' => '',
|
|
'Request By' => '',
|
|
'Priority' => '',
|
|
);
|
|
}
|
|
}
|