Code Duplication    Length = 5-5 lines in 6 locations

cloudcontrol/library/search/indexer/InverseDocumentFrequency.php 1 location

@@ 47-51 (lines=5) @@
44
				  GROUP BY term
45
		';
46
47
		if (!$stmt = $db->prepare($sql)) {
48
			$errorInfo = $db->errorInfo();
49
			$errorMsg = $errorInfo[2];
50
			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
51
		}
52
		$stmt->bindValue(':documentCount', $this->documentCount);
53
		$result = $stmt->execute();
54
		if ($result === false) {

cloudcontrol/library/search/indexer/TermFieldLengthNorm.php 2 locations

@@ 50-54 (lines=5) @@
47
			$errorMsg = $errorInfo[2];
48
			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
49
		}
50
		if (($stmt->execute()) === false) {
51
			$errorInfo = $db->errorInfo();
52
			$errorMsg = $errorInfo[2];
53
			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
54
		}
55
		$uniqueFieldsPerDocument = $stmt->fetchAll(\PDO::FETCH_OBJ);
56
		$values = array();
57
		$i = 0;
@@ 82-86 (lines=5) @@
79
		$sql  = 'BEGIN TRANSACTION;' . PHP_EOL;
80
		$sql .= implode(PHP_EOL, $values) . PHP_EOL;
81
		$sql .= 'COMMIT;';
82
		if (($db->exec($sql)) === false) {
83
			$errorInfo = $db->errorInfo();
84
			$errorMsg = $errorInfo[2];
85
			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
86
		}
87
	}
88
}

cloudcontrol/library/search/Search.php 1 location

@@ 79-83 (lines=5) @@
76
			SELECT count(DISTINCT documentPath) as indexedDocuments
77
			  FROM term_frequency
78
		';
79
		if (!$stmt = $db->query($sql)) {
80
			$errorInfo = $db->errorInfo();
81
			$errorMsg = $errorInfo[2];
82
			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
83
		}
84
		$result = $stmt->fetch(\PDO::FETCH_COLUMN);
85
		if (false === $result) {
86
			$errorInfo = $db->errorInfo();

cloudcontrol/library/search/indexer/TermFrequency.php 1 location

@@ 108-112 (lines=5) @@
105
	private function executeStore($sql, $values, $db)
106
	{
107
		$sql .= '(' . implode('),' . PHP_EOL . '(', $values) . ');';
108
		if (!$db->query($sql)) {
109
			$errorInfo = $db->errorInfo();
110
			$errorMsg = $errorInfo[2];
111
			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
112
		}
113
	}
114
115
}

cloudcontrol/library/search/indexer/TermCount.php 1 location

@@ 96-100 (lines=5) @@
93
		$sql .= '(' . implode('),' . PHP_EOL . '(', $values) . ');';
94
95
		$stmt = $db->prepare($sql);
96
		if ($stmt === false || !$stmt->execute()) {
97
			$errorInfo = $db->errorInfo();
98
			$errorMsg = $errorInfo[2];
99
			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
100
		}
101
	}
102
103
	/**