Completed
Push — federated-circles ( ec0d47...dba84e )
by Maxence
02:42
created

FederatedLinksRequestBuilder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 59
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getLinksInsertSql() 0 7 1
A getLinksUpdateSql() 0 6 1
A getLinksDeleteSql() 0 6 1
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\Model\Member;
33
use OCA\Circles\Service\MiscService;
34
use OCP\DB\QueryBuilder\IQueryBuilder;
35
use OCP\IDBConnection;
36
use OCP\Share;
37
use OCP\Share\IShare;
38
39
class FederatedLinksRequestBuilder {
40
41
	/** @var IDBConnection */
42
	protected $dbConnection;
43
44
	/** @var MiscService */
45
	protected $miscService;
46
47
	/**
48
	 * CirclesRequest constructor.
49
	 *
50
	 * @param IDBConnection $connection
51
	 * @param MiscService $miscService
52
	 */
53
	public function __construct(IDBConnection $connection, MiscService $miscService) {
54
		$this->dbConnection = $connection;
55
		$this->miscService = $miscService;
56
	}
57
58
59
	/**
60
	 * Base of the Sql Insert request
61
	 *
62
	 * @return IQueryBuilder
63
	 */
64
	protected function getLinksInsertSql() {
65
		$qb = $this->dbConnection->getQueryBuilder();
66
		$qb->insert('circles_federated')
67
		   ->setValue('creation', $qb->createFunction('NOW()'));
68
69
		return $qb;
70
	}
71
72
73
	/**
74
	 * Base of the Sql Update request
75
	 *
76
	 * @return IQueryBuilder
77
	 */
78
	protected function getLinksUpdateSql() {
79
		$qb = $this->dbConnection->getQueryBuilder();
80
		$qb->update('circles_federated');
81
		
82
		return $qb;
83
	}
84
85
86
	/**
87
	 * Base of the Sql Delete request
88
	 *
89
	 * @return IQueryBuilder
90
	 */
91
	protected function getLinksDeleteSql() {
92
		$qb = $this->dbConnection->getQueryBuilder();
93
		$qb->delete('circles_federated');
94
95
		return $qb;
96
	}
97
}