Code Duplication    Length = 13-15 lines in 3 locations

src/Controller/Collection.php 3 locations

@@ 134-148 (lines=15) @@
131
	 *
132
	 * @return void
133
	 */
134
	public function edit()
135
	{
136
		$data = $this->request->getParsedBody();
137
		if (array_key_exists('hummingbird_id', $data))
138
		{
139
			$this->anime_collection_model->update($data);
140
			$this->set_flash_message('Successfully updated collection item.', 'success');
141
		}
142
		else
143
		{
144
			$this->set_flash_message('Failed to update collection item', 'error');
145
		}
146
147
		$this->session_redirect();
148
	}
149
150
	/**
151
	 * Add a collection item
@@ 155-169 (lines=15) @@
152
	 *
153
	 * @return void
154
	 */
155
	public function add()
156
	{
157
		$data = $this->request->getParsedBody();
158
		if (array_key_exists('id', $data))
159
		{
160
			$this->anime_collection_model->add($data);
161
			$this->set_flash_message('Successfully added collection item', 'success');
162
		}
163
		else
164
		{
165
			$this->set_flash_message('Failed to add collection item.', 'error');
166
		}
167
168
		$this->session_redirect();
169
	}
170
171
	/**
172
	 * Remove a collection item
@@ 176-188 (lines=13) @@
173
	 *
174
	 * @return void
175
	 */
176
	public function delete()
177
	{
178
		$data = $this->request->getParsedBody();
179
		if ( ! array_key_exists('hummingbird_id', $data))
180
		{
181
			$this->redirect("/collection/view", 303);
182
		}
183
184
		$this->anime_collection_model->delete($data);
185
		$this->set_flash_message("Successfully removed anime from collection.", 'success');
186
187
		$this->redirect("/collection/view", 303);
188
	}
189
}
190
// End of CollectionController.php