Passed
Push — master ( 90401e...63cb31 )
by Roeland
20:41 queued 20s
created

SearchQuery::getOffset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Copyright (c) 2017 Robin Appelman <[email protected]>
4
 *
5
 * @author Robin Appelman <[email protected]>
6
 *
7
 * @license GNU AGPL version 3 or any later version
8
 *
9
 * This program is free software: you can redistribute it and/or modify
10
 * it under the terms of the GNU Affero General Public License as
11
 * published by the Free Software Foundation, either version 3 of the
12
 * License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU Affero General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Affero General Public License
20
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 *
22
 */
23
24
namespace OC\Files\Search;
25
26
use OCP\Files\Search\ISearchOperator;
27
use OCP\Files\Search\ISearchOrder;
28
use OCP\Files\Search\ISearchQuery;
29
use OCP\IUser;
30
31
class SearchQuery implements ISearchQuery {
32
	/** @var  ISearchOperator */
33
	private $searchOperation;
34
	/** @var  integer */
35
	private $limit;
36
	/** @var  integer */
37
	private $offset;
38
	/** @var  ISearchOrder[] */
39
	private $order;
40
	/** @var IUser */
41
	private $user;
42
	private $limitToHome;
43
44
	/**
45
	 * SearchQuery constructor.
46
	 *
47
	 * @param ISearchOperator $searchOperation
48
	 * @param int $limit
49
	 * @param int $offset
50
	 * @param array $order
51
	 * @param IUser $user
52
	 * @param bool $limitToHome
53
	 */
54
	public function __construct(
55
		ISearchOperator $searchOperation,
56
		int $limit,
57
		int $offset,
58
		array $order,
59
		IUser $user,
60
		bool $limitToHome = false
61
	) {
62
		$this->searchOperation = $searchOperation;
63
		$this->limit = $limit;
64
		$this->offset = $offset;
65
		$this->order = $order;
66
		$this->user = $user;
67
		$this->limitToHome = $limitToHome;
68
	}
69
70
	/**
71
	 * @return ISearchOperator
72
	 */
73
	public function getSearchOperation() {
74
		return $this->searchOperation;
75
	}
76
77
	/**
78
	 * @return int
79
	 */
80
	public function getLimit() {
81
		return $this->limit;
82
	}
83
84
	/**
85
	 * @return int
86
	 */
87
	public function getOffset() {
88
		return $this->offset;
89
	}
90
91
	/**
92
	 * @return ISearchOrder[]
93
	 */
94
	public function getOrder() {
95
		return $this->order;
96
	}
97
98
	/**
99
	 * @return IUser
100
	 */
101
	public function getUser() {
102
		return $this->user;
103
	}
104
105
	public function limitToHome(): bool {
106
		return $this->limitToHome;
107
	}
108
}
109