Codacy cleanup

This commit is contained in:
Matthew Ross 2018-07-28 21:59:11 -04:00
parent ee3680057b
commit 8b7681b364
2 changed files with 16 additions and 37 deletions

View File

@ -91,7 +91,6 @@ class TbGitHubImport {
);
$data = json_decode(curl_exec($this->ch));
$columns = [];
$colPos = 1;
foreach ($data as $column) {
@ -135,7 +134,7 @@ class TbGitHubImport {
}
private function importData() {
foreach($this->projects as $project) {
foreach ($this->projects as $project) {
print " Importing Project " . $project->name . "...\n";
$exists = $this->db->querySingle('SELECT id FROM board WHERE name = "' .
@ -216,7 +215,7 @@ class TbGitHubImport {
$stmt = $this->db->prepare('INSERT INTO task (title, description, ' .
'color, position, column_id) VALUES (:title, :description, :color,' .
':pos, :col_id)');
foreach($column->cards as $card) {
foreach ($column->cards as $card) {
$stmt->bindValue(':title', $card->title);
$stmt->bindValue(':description', $card->description);
$stmt->bindValue(':color', $card->color);

View File

@ -12,7 +12,7 @@ class TbMigrate {
} catch (Exception $e) {
print "\t\tError opening 'taskboard.db'\n";
print " " . $e->getMessage() . "\n";
die();
return;
}
print "Opening 'taskboard.sqlite'...";
@ -24,7 +24,7 @@ class TbMigrate {
} catch (Exception $e) {
print "\t\tError creating 'taskboard.sqlite'\n";
print " " . $e->getMessage() . "\n";
die();
return;
}
}
@ -102,17 +102,17 @@ class TbMigrate {
private function getActionType($row) {
switch ($row['action_id']) {
case 0:
return 1;
break;
case 2:
return 4;
break;
case 3:
return 6;
break;
default:
return null;
case 0:
return 1;
break;
case 2:
return 4;
break;
case 3:
return 6;
break;
default:
return null;
}
}
@ -290,8 +290,7 @@ class TbMigrate {
'VALUES (' . $row['assignee'] . ', ' . $row['id'] . ')');
$this->newDb->exec('INSERT INTO category_task (category_id, task_id) ' .
'VALUES (' . $row['category'] . ', ' . $row['id'] . ')');
}, 'item', function ($lastId, $row) {
});
}, 'item');
}
private function migrateLane() {
@ -306,25 +305,6 @@ class TbMigrate {
}, 'lane');
}
private function migrateOption() {
$stmtStr = 'INSERT INTO useroption (id, new_tasks_at_bottom, ' .
'show_animations, show_assignee, multiple_tasks_per_row, language) ' .
'VALUES (:id, :atBottom, :anims, :assignee, 0, "en")';
$this->migrateTable($stmtStr, function (&$stmt, $row) {
$stmt->bindValue(':id', $row['id']);
$stmt->bindValue(':atBottom', isset($row['tasks_order'])
? $row['tasks_order']
: $row['new_task_position']);
$stmt->bindValue(':anims', isset($row['animate'])
? $row['animate']
: $row['show_animations']);
$stmt->bindValue(':assignee', isset($row['show_assignee'])
? $row['show_assignee']
: 1);
}, 'option');
}
private function migrateUser() {
$stmtStr = 'INSERT INTO user (id, username, security_level, password_hash, ' .
'email, default_board_id, user_option_id, last_login) VALUES (:id, ' .