Code Duplication    Length = 8-8 lines in 3 locations

db/trackmapper.php 2 locations

@@ 120-127 (lines=8) @@
117
	 * @param string $userId
118
	 * @return integer
119
	 */
120
	public function countByArtist($artistId, $userId){
121
		$sql = 'SELECT COUNT(*) AS count FROM `*PREFIX*music_tracks` `track` '.
122
			'WHERE `track`.`user_id` = ? AND `track`.`artist_id` = ?';
123
		$params = array($userId, $artistId);
124
		$result = $this->execute($sql, $params);
125
		$row = $result->fetch();
126
		return $row['count'];
127
	}
128
129
	/**
130
	 * @param integer $albumId
@@ 134-141 (lines=8) @@
131
	 * @param string $userId
132
	 * @return integer
133
	 */
134
	public function countByAlbum($albumId, $userId){
135
		$sql = 'SELECT COUNT(*) AS count FROM `*PREFIX*music_tracks` `track` '.
136
			'WHERE `track`.`user_id` = ? AND `track`.`album_id` = ?';
137
		$params = array($userId, $albumId);
138
		$result = $this->execute($sql, $params);
139
		$row = $result->fetch();
140
		return $row['count'];
141
	}
142
143
	/**
144
	 * @param string $name

db/basemapper.php 1 location

@@ 42-49 (lines=8) @@
39
	/**
40
	 * @param string $userId
41
	 */
42
	public function count($userId){
43
		$sql = 'SELECT COUNT(*) AS count FROM `' . $this->getTableName() . '` '.
44
			'WHERE `user_id` = ?';
45
		$params = array($userId);
46
		$result = $this->execute($sql, $params);
47
		$row = $result->fetch();
48
		return $row['count'];
49
	}
50
51
	/**
52
	 * helper creating a string like '(?,?,?)' with the specified number of elements