Passed
Push — master ( d93244...31d6f2 )
by Pauli
03:37
created

RadioStationMapper::findUniqueEntity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
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 Pauli Järvinen <[email protected]>
10
 * @copyright Pauli Järvinen 2020 - 2025
11
 */
12
13
namespace OCA\Music\Db;
14
15
use OCP\IConfig;
16
use OCP\IDBConnection;
17
18
/**
19
 * @method RadioStation findEntity(string $sql, array $params)
20
 * @phpstan-extends BaseMapper<RadioStation>
21
 */
22
class RadioStationMapper extends BaseMapper {
23
	public function __construct(IDBConnection $db, IConfig $config) {
24
		parent::__construct($db, $config, 'music_radio_stations', RadioStation::class, 'name');
25
	}
26
27
	/**
28
	 * @return RadioStation
29
	 */
30
	public function findByStreamUrl(string $url, string $userId) : RadioStation {
31
		$sql = $this->selectUserEntities("`stream_url` = ?");
32
		return $this->findEntity($sql, [$userId, $url]);
33
	}
34
}
35