Code Duplication    Length = 5-5 lines in 10 locations

src/search/indexer/InverseDocumentFrequency.php 1 location

@@ 54-58 (lines=5) @@
51
		}
52
		$stmt->bindValue(':documentCount', $this->documentCount);
53
		$result = $stmt->execute();
54
		if ($result === false) {
55
			$errorInfo = $db->errorInfo();
56
			$errorMsg = $errorInfo[2];
57
			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
58
		}
59
	}
60
}

src/search/indexer/TermCount.php 1 location

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

src/search/indexer/TermFieldLengthNorm.php 3 locations

@@ 45-49 (lines=5) @@
42
	  GROUP BY documentPath, field
43
		';
44
		$stmt = $db->prepare($sql);
45
		if ($stmt === false) {
46
			$errorInfo = $db->errorInfo();
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];
@@ 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
}

src/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
}

src/search/Search.php 1 location

@@ 85-89 (lines=5) @@
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();
87
			$errorMsg = $errorInfo[2];
88
			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
89
		}
90
		return intval($result);
91
	}
92

src/storage/Repository.php 3 locations

@@ 411-415 (lines=5) @@
408
		';
409
		$stmt = $db->query($sql);
410
		$result = $stmt->fetchAll(\PDO::FETCH_CLASS, '\CloudControl\Cms\storage\Document');
411
		if ($stmt === false || !$stmt->execute()) {
412
			$errorInfo = $db->errorInfo();
413
			$errorMsg = $errorInfo[2];
414
			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
415
		}
416
		return $result;
417
	}
418
@@ 434-438 (lines=5) @@
431
		}
432
		$db = $this->getContentDbHandle();
433
		$stmt = $db->prepare($sql);
434
		if ($stmt === false) {
435
			$errorInfo = $db->errorInfo();
436
			$errorMsg = $errorInfo[2];
437
			throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
438
		}
439
		$stmt->bindValue(':path', $path);
440
		$stmt->execute();
441
	}
@@ 501-505 (lines=5) @@
498
    {
499
        $db = $this->getContentDbHandle();
500
        $stmt = $db->query($sql);
501
        if ($stmt === false) {
502
            $errorInfo = $db->errorInfo();
503
            $errorMsg = $errorInfo[2];
504
            throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
505
        }
506
        return $stmt;
507
    }
508