Passed
Push — master ( 40b137...b03450 )
by Pauli
02:02
created

PlaylistMapper::makeSelectQuery()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * ownCloud - Music app
5
 *
6
 * This file is licensed under the Affero General Public License version 3 or
7
 * later. See the COPYING file.
8
 *
9
 * @author Morris Jobke <[email protected]>
10
 * @author Volkan Gezer <[email protected]>
11
 * @author Pauli Järvinen <[email protected]>
12
 * @copyright Morris Jobke 2014
13
 * @copyright Volkan Gezer 2014
14
 * @copyright Pauli Järvinen 2016 - 2020
15
 */
16
17
namespace OCA\Music\Db;
18
19
use OCP\IDBConnection;
0 ignored issues
show
Bug introduced by
The type OCP\IDBConnection was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
21
class PlaylistMapper extends BaseMapper {
22
	public function __construct(IDBConnection $db) {
23
		parent::__construct($db, 'music_playlists', '\OCA\Music\Db\Playlist', 'name');
24
	}
25
26
	/**
27
	 * @param int $trackId
28
	 * @return Playlist[]
29
	 */
30
	public function findListsContainingTrack($trackId) {
31
		$sql = $this->selectEntities('`track_ids` LIKE ?');
32
		$params = ['%|' . $trackId . '|%'];
33
		return $this->findEntities($sql, $params);
34
	}
35
36
	/**
37
	 * @see \OCA\Music\Db\BaseMapper::findUniqueEntity()
38
	 * @param Playlist $playlist
39
	 * @return Playlist
40
	 */
41
	protected function findUniqueEntity($playlist) {
42
		// The playlist table has no unique constraints, and hence, this function
43
		// should never be called.
44
		throw new \BadMethodCallException('not supported');
45
	}
46
}
47