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

@@ 305-316 (lines=12) @@
302
		return false;
303
	}
304
305
	private function nameRequestExists()
306
	{
307
		$query = "SELECT COUNT(id) FROM request WHERE status != 'Closed' AND name = :name;";
308
		$statement = $this->database->prepare($query);
309
		$statement->execute(array(':name' => $this->request->getName()));
310
311
		if (!$statement) {
312
			return false;
313
		}
314
315
		return $statement->fetchColumn() > 0;
316
	}
317
}
318