Code Duplication    Length = 12-16 lines in 2 locations

includes/Providers/TorExitProvider.php 1 location

@@ 36-51 (lines=16) @@
33
	 *
34
	 * @return bool
35
	 */
36
	public function isTorExit($ip)
37
	{
38
		$statement = $this->database->prepare('SELECT COUNT(1) FROM tornodecache WHERE ipaddr = :ip');
39
40
		$statement->execute(array(':ip' => $ip));
41
42
		$count = $statement->fetchColumn();
43
		$statement->closeCursor();
44
45
		if ($count > 0) {
46
			return true;
47
		}
48
		else {
49
			return false;
50
		}
51
	}
52
53
	public static function regenerate(PdoDatabase $database, HttpHelper $httpHelper, $destinationIps)
54
	{

includes/Validation/RequestValidationHelper.php 1 location

@@ 299-310 (lines=12) @@
296
	 *
297
	 * @return bool
298
	 */
299
	private function nameRequestExists()
300
	{
301
		$query = "SELECT COUNT(id) FROM request WHERE status != 'Closed' AND name = :name;";
302
		$statement = $this->database->prepare($query);
303
		$statement->execute(array(':name' => $this->request->getName()));
304
305
		if (!$statement) {
306
			return false;
307
		}
308
309
		return $statement->fetchColumn() > 0;
310
	}
311
}
312