GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 856a6b...b18c19 )
by Jacky
05:00
created

RecyclingLogRepository::update()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 41
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 41
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
namespace Asylamba\Modules\Athena\Repository;
4
5
use Asylamba\Classes\Entity\AbstractRepository;
6
7
use Asylamba\Modules\Athena\Model\RecyclingLog;
8
9
class RecyclingLogRepository extends AbstractRepository
10
{
11
	/**
12
	 * @param int $baseId
13
	 * @return array
14
	 */
15
	public function getBaseActiveMissionsLogs($baseId)
16
	{
17
		$statement = $this->connection->prepare(
18
			'SELECT rl.* FROM recyclingLog rl
19
			INNER JOIN recyclingMission rm ON rm.id = rl.rRecycling
20
			INNER JOIN place p ON p.id = rm.rBase
21
			WHERE p.id = :base_id
22
			ORDER BY rl.dLog DESC'
23
		);
24
		$statement->execute(['base_id' => $baseId]);
25
		$data = [];
26
		while ($row = $statement->fetch()) {
27
			$data[] = $this->format($row);
28
		}
29
		return $data;
30
	}
31
	
32
	public function insert($recyclingLog)
33
	{
34
		$statement = $this->connection->prepare(
35
			'INSERT INTO
36
			recyclingLog(rRecycling, resources, credits, ship0, ship1, ship2, ship3, ship4, ship5, ship6, ship7,
37
				ship8, ship9, ship10, ship11, dLog)
38
			VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
39
		);
40
		$statement->execute(array(
41
			$recyclingLog->rRecycling,
42
			$recyclingLog->resources,
43
			$recyclingLog->credits,
44
			$recyclingLog->ship0,
45
			$recyclingLog->ship1,
46
			$recyclingLog->ship2,
47
			$recyclingLog->ship3,
48
			$recyclingLog->ship4,
49
			$recyclingLog->ship5,
50
			$recyclingLog->ship6,
51
			$recyclingLog->ship7,
52
			$recyclingLog->ship8,
53
			$recyclingLog->ship9,
54
			$recyclingLog->ship10,
55
			$recyclingLog->ship11,
56
			$recyclingLog->dLog
57
		));
58
		$recyclingLog->id = $this->connection->lastInsertId();
59
	}
60
	
61
	public function update($recyclingLog)
62
	{
63
//		$statement = $this->connection->prepare(
64
//			'UPDATE recyclingLog SET
65
//				rRecycling = ?,
66
//				resources = ?,
67
//				credits = ?,
68
//				ship0 = ?,
69
//				ship1 = ?,
70
//				ship2 = ?,
71
//				ship3 = ?,
72
//				ship4 = ?,
73
//				ship5 = ?,
74
//				ship6 = ?,
75
//				ship7 = ?,
76
//				ship8 = ?,
77
//				ship9 = ?,
78
//				ship10 = ?,
79
//				ship11 = ?,
80
//				dLog = ?
81
//			WHERE id = ?');
82
//		$statement->execute(array(
83
//			$recyclingLog->rRecycling,
84
//			$recyclingLog->resources,
85
//			$recyclingLog->credits,
86
//			$recyclingLog->ship0,
87
//			$recyclingLog->ship1,
88
//			$recyclingLog->ship2,
89
//			$recyclingLog->ship3,
90
//			$recyclingLog->ship4,
91
//			$recyclingLog->ship5,
92
//			$recyclingLog->ship6,
93
//			$recyclingLog->ship7,
94
//			$recyclingLog->ship8,
95
//			$recyclingLog->ship9,
96
//			$recyclingLog->ship10,
97
//			$recyclingLog->ship11,
98
//			$recyclingLog->dLog,
99
//			$recyclingLog->id
100
//		));
101
	}
102
	
103
	public function remove($recyclingLog)
104
	{
105
		$statement = $this->connection->prepare('DELETE FROM recyclingLog WHERE id = :id');
106
		$statement->execute(['id' => $recyclingLog->id]);
107
	}
108
	
109
	public function removeMissionLogs($recyclingMissionId)
110
	{
111
		$statement = $this->connection->prepare('DELETE FROM recyclingLog WHERE rRecycling = :mission_id');
112
		$statement->execute(['mission_id' => $recyclingMissionId]);
113
	}
114
	
115
	public function format($data)
116
	{
117
		$recyclingLog = new RecyclingLog();
118
119
		$recyclingLog->id = (int) $data['id'];
120
		$recyclingLog->rRecycling = (int) $data['rRecycling'];
121
		$recyclingLog->resources = (int) $data['resources'];
122
		$recyclingLog->credits = (int) $data['credits'];
123
		$recyclingLog->ship0 = (int) $data['ship0'];
124
		$recyclingLog->ship1 = (int) $data['ship1'];
125
		$recyclingLog->ship2 = (int) $data['ship2'];
126
		$recyclingLog->ship3 = (int) $data['ship3'];
127
		$recyclingLog->ship4 = (int) $data['ship4'];
128
		$recyclingLog->ship5 = (int) $data['ship5'];
129
		$recyclingLog->ship6 = (int) $data['ship6'];
130
		$recyclingLog->ship7 = (int) $data['ship7'];
131
		$recyclingLog->ship8 = (int) $data['ship8'];
132
		$recyclingLog->ship9 = (int) $data['ship9'];
133
		$recyclingLog->ship10 = (int) $data['ship10'];
134
		$recyclingLog->ship11 = (int) $data['ship11'];
135
		$recyclingLog->dLog = $data['dLog'];
136
		
137
		return $recyclingLog;
138
	}
139
}