Passed
Pull Request — master (#875)
by Pauli
04:50 queued 02:21
created

PodcastChannelMapper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 4
c 2
b 0
f 0
dl 0
loc 13
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A findUniqueEntity() 0 3 1
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 2021
11
 */
12
13
namespace OCA\Music\Db;
14
15
use \OCP\AppFramework\Db\Entity;
16
use \OCP\IDBConnection;
17
18
/**
19
 * Type hint a base class methdo to help Scrutinizer
20
 * @method PodcastChannel insert(PodcastChannel $channel)
21
 */
22
class PodcastChannelMapper extends BaseMapper {
23
	public function __construct(IDBConnection $db) {
24
		parent::__construct($db, 'music_podcast_channels', '\OCA\Music\Db\PodcastChannel', 'title');
25
	}
26
27
	/**
28
	 * @see \OCA\Music\Db\BaseMapper::findUniqueEntity()
29
	 * @param PodcastChannel $channel
30
	 * @return PodcastChannel
31
	 */
32
	protected function findUniqueEntity(Entity $channel) : Entity {
33
		$sql = $this->selectUserEntities("`rss_hash` = ?");
34
		return $this->findEntity($sql, [$channel->getUserId(), $channel->getRssHash()]);
35
	}
36
}
37