Completed
Push — master ( f21795...e63d25 )
by Janis
02:34
created

ShareMapper::find()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 3
crap 1
1
<?php
2
/**
3
 * nextCloud - ocr
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Janis Koehr <[email protected]>
9
 * @copyright Janis Koehr 2016
10
 */
11
12
namespace OCA\Ocr\Db;
13
14
use OCP\AppFramework\Db\Mapper;
15
use OCP\IDBConnection;
16
17
/**
18
 * Class ShareMapper
19
 *
20
 * @package OCA\Ocr\Db
21
 */
22 View Code Duplication
class ShareMapper extends Mapper {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
	/**
24
	 * ShareMapper constructor.
25
	 *
26
	 * @param IDBConnection $db
27
	 */
28 6
	public function __construct(IDBConnection $db) {
29 6
		parent::__construct($db, 'share', 'OCA\Ocr\Db\Share');
30 6
	}
31
32
	/**
33
	 * Find the right name for a shared file
34
	 *
35
	 * @param integer $fileid
36
	 * @param string $shareWith
37
	 * @param string $owner
38
	 * @return Share
39
	 */
40 2
	public function find($fileid, $shareWith, $owner) {
41 2
		$sql = 'SELECT file_target FROM *PREFIX*share WHERE file_source = ? AND share_with = ? AND uid_owner = ?';
42 2
		return $this->findEntity($sql, [$fileid, $shareWith, $owner]);
43
	}
44
}