Code Duplication    Length = 27-32 lines in 2 locations

application/controllers/Bbs.php 2 locations

@@ 88-114 (lines=27) @@
85
	}
86
87
	// 確認ページ
88
	public function confirm()
89
	{
90
# 検証ルールを設定します。
91
		$this->_set_validation();
92
93
# 検証をパスしなかった場合は、新規投稿ページを表示します。検証をパスした場合
94
# は、投稿確認ページ(bbs_confirm)を表示します。
95
		if ($this->form_validation->run() == FALSE)
96
		{
97
# 投稿されたIDのキャプチャを削除します。
98
			$this->_delete_captcha_data();
99
100
			$this->_show_post_page();
101
		}
102
		else
103
		{
104
			$data = [];
105
			$data['name']       = $this->input->post('name');
106
			$data['email']      = $this->input->post('email');
107
			$data['subject']    = $this->input->post('subject');
108
			$data['body']       = $this->input->post('body');
109
			$data['password']   = $this->input->post('password');
110
			$data['key']        = $this->input->post('key');
111
			$data['captcha']    = $this->input->post('captcha');
112
			$this->_load_view('bbs_confirm', $data);
113
		}
114
	}
115
116
# 投稿されたIDのキャプチャを削除します。
117
	private function _delete_captcha_data()
@@ 259-290 (lines=32) @@
256
	}
257
258
# 投稿された記事をデータベースに登録します。
259
	public function insert()
260
	{
261
# 検証ルールを設定します。
262
		$this->_set_validation();
263
264
# 検証にパスしない場合は、新規投稿ページを表示します。
265
		if ($this->form_validation->run() == FALSE)
266
		{
267
# 投稿されたIDのキャプチャを削除します。
268
			$this->_delete_captcha_data();
269
270
			$this->_show_post_page();
271
		}
272
		else
273
		{
274
# 検証にパスした場合は、送られたデータとIPアドレスをbbsテーブルに登録します。
275
			$data = [];
276
			$data['name']       = $this->input->post('name');
277
			$data['email']      = $this->input->post('email');
278
			$data['subject']    = $this->input->post('subject');
279
			$data['body']       = $this->input->post('body');
280
			$data['password']   = $this->input->post('password');
281
			$data['ip_address'] = $this->input->server('REMOTE_ADDR');
282
			$this->db->insert('bbs', $data);
283
284
# 投稿されたIDのキャプチャを削除します。
285
			$this->_delete_captcha_data();
286
287
# URLヘルパーのredirect()メソッドで記事表示ページにリダイレクトします。
288
			redirect('/bbs');
289
		}
290
	}
291
292
# キャプチャの検証をするメソッドです。バリデーション(認証)クラスより呼ばれます。
293
	public function captcha_check($str)