Completed
Push — master ( a32ba7...f7592a )
by Maxence
05:20
created

SharesRequestBuilder::getSharesDeleteSql()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
/**
4
 * Circles - Bring cloud-users closer together.
5
 *
6
 * This file is licensed under the Affero General Public License version 3 or
7
 * later. See the COPYING file.
8
 *
9
 * @author Maxence Lange <[email protected]>
10
 * @copyright 2017
11
 * @license GNU AGPL version 3 or any later version
12
 *
13
 * This program is free software: you can redistribute it and/or modify
14
 * it under the terms of the GNU Affero General Public License as
15
 * published by the Free Software Foundation, either version 3 of the
16
 * License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU Affero General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU Affero General Public License
24
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
25
 *
26
 */
27
28
namespace OCA\Circles\Db;
29
30
31
use Doctrine\DBAL\Query\QueryBuilder;
32
use OCA\Circles\Exceptions\ConfigNoCircleAvailableException;
33
use OCA\Circles\Model\Circle;
34
use OCA\Circles\Model\Member;
35
use OCA\Circles\Model\SharingFrame;
36
use OCA\Circles\Service\ConfigService;
37
use OCA\Circles\Service\MiscService;
38
use OCP\DB\QueryBuilder\IQueryBuilder;
39
use OCP\IDBConnection;
40
use OCP\IL10N;
41
42
class SharesRequestBuilder extends CoreRequestBuilder {
43
44
45
	/**
46
	 * SharesRequestBuilder constructor.
47
	 *
48
	 * {@inheritdoc}
49
	 * @param MembersRequest $membersRequest
0 ignored issues
show
Bug introduced by
There is no parameter named $membersRequest. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
50
	 */
51
	public function __construct(
52
		IL10N $l10n, IDBConnection $connection, ConfigService $configService,
53
		MiscService $miscService
54
	) {
55
		parent::__construct($l10n, $connection, $configService, $miscService);
56
	}
57
58
59
	/**
60
	 * Base of the Sql Delete request
61
	 *
62
	 * @return IQueryBuilder
63
	 */
64 View Code Duplication
	protected function getSharesDeleteSql() {
0 ignored issues
show
Duplication introduced by
This method 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...
65
		$qb = $this->dbConnection->getQueryBuilder();
66
		$qb->delete(self::TABLE_FILE_SHARES);
67
		$qb->where(
68
			$qb->expr()
69
			   ->eq('share_type', $qb->createNamedParameter(self::SHARE_TYPE))
70
		);
71
72
		return $qb;
73
	}
74
75
76
}