Passed
Pull Request — master (#6)
by Dark❶
02:17
created

rsi_003::strIgnoreCommonWords()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 9
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 12
rs 9.9666
1
<?php
2
/**
3
 *
4
 * Reduce Search Index [RSI]. An extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2020-2021, Dark❶, https://dark1.tech
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace dark1\reducesearchindex\migrations;
12
13
/**
14
 * @ignore
15
 */
16
use phpbb\db\migration\migration;
17
18
/**
19
 * Migration stage 003 : N/A
20
 */
21
class rsi_003 extends migration
22
{
23
	static public function depends_on()
24
	{
25
		return ['\dark1\reducesearchindex\migrations\rsi_002'];
26
	}
27
28
	public function update_data()
29
	{
30
		return [
31
			['config.add', ['dark1_rsi_ign_com_enable', 0]],
32
			['config_text.add', ['dark1_rsi_ign_com_words', $this->strIgnoreCommonWords()]],
33
		];
34
	}
35
36
	/**
37
	 * Ignore Common Words each on new line as a string
38
	 *
39
	 * @return string
40
	 * @access private
41
	 */
42
	private function strIgnoreCommonWords()
43
	{
44
		$common_words_ary = [
45
			'a', 'about', 'all', 'an', 'and', 'any', 'are', 'as', 'at', 'be', 'been', 'but', 'by',
46
			'call', 'can', 'come', 'could', 'did', 'do', 'down', 'each', 'find', 'first', 'for', 'from', 'get', 'go',
47
			'had', 'has', 'have', 'he', 'her', 'him', 'his', 'how', 'i', 'if', 'in', 'into', 'is', 'it', 'its',
48
			'like', 'long', 'look', 'made', 'make', 'many', 'may', 'more', 'my', 'no', 'not', 'now', 'none', 'number',
49
			'of', 'on', 'or', 'other', 'out', 'part', 'people', 'said', 'see', 'she', 'so', 'some',
50
			'than', 'that', 'the', 'their', 'them', 'then', 'there', 'these', 'they', 'this', 'to', 'up', 'use',
51
			'was', 'way', 'we', 'were', 'what', 'when', 'which', 'who', 'will', 'with', 'would', 'you', 'your',
52
		];
53
		return implode("\n", $common_words_ary);
54
	}
55
}
56