Code Duplication    Length = 3-3 lines in 4 locations

src/search/Search.php 4 locations

@@ 162-164 (lines=3) @@
159
		}
160
		$stmt->bindValue(':query', $token);
161
		$stmt->bindValue(':queryNorm', $queryNorm);
162
		if (!$stmt->execute()) {
163
			throw new \Exception('SQLite exception: <pre>' . print_r($db->errorInfo(), true) . '</pre> for SQL:<pre>' . $sql . '</pre>');
164
		}
165
		return $stmt->fetchAll(\PDO::FETCH_CLASS, '\CloudControl\Cms\search\results\SearchResult');
166
	}
167
@@ 224-226 (lines=3) @@
221
		if(!$stmt = $db->prepare($sql)) {
222
			throw new \Exception('SQLite exception: <pre>' . print_r($db->errorInfo(), true) . '</pre> for SQL:<pre>' . $sql . '</pre>');
223
		}
224
		if (!$stmt->execute()) {
225
			throw new \Exception('SQLite exception: <pre>' . print_r($db->errorInfo(), true) . '</pre> for SQL:<pre>' . $sql . '</pre>');
226
		}
227
		$result = $stmt->fetch(\PDO::FETCH_OBJ);
228
		return $result->queryNorm == null ? 1 : $result->queryNorm;
229
	}
@@ 274-276 (lines=3) @@
271
			  	   WHERE editDistance > 0
272
			';
273
			$stmt = $db->prepare($sql);
274
			if ($stmt === false) {
275
				throw new \Exception('SQLite exception: <pre>' . print_r($db->errorInfo(), true) . '</pre> for SQL:<pre>' . $sql . '</pre>');
276
			}
277
			$stmt->bindValue(':token', $token);
278
			if (($stmt === false) | (!$stmt->execute())) {
279
				throw new \Exception('SQLite exception: <pre>' . print_r($db->errorInfo(), true) . '</pre> for SQL:<pre>' . $sql . '</pre>');
@@ 278-280 (lines=3) @@
275
				throw new \Exception('SQLite exception: <pre>' . print_r($db->errorInfo(), true) . '</pre> for SQL:<pre>' . $sql . '</pre>');
276
			}
277
			$stmt->bindValue(':token', $token);
278
			if (($stmt === false) | (!$stmt->execute())) {
279
				throw new \Exception('SQLite exception: <pre>' . print_r($db->errorInfo(), true) . '</pre> for SQL:<pre>' . $sql . '</pre>');
280
			}
281
			$result = $stmt->fetchAll(\PDO::FETCH_CLASS, '\CloudControl\Cms\search\results\SearchSuggestion');
282
			$allResults = array_merge($result, $allResults);
283
		}