Completed
Push — master ( 93bf15...69947f )
by Maxence
01:58
created

ProviderIndexes::isDocumentIndexUpToDate()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 16
rs 9.4285
cc 3
eloc 10
nc 4
nop 1
1
<?php
2
/**
3
 * FullTextSearch - Full text search framework for Nextcloud
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Maxence Lange <[email protected]>
9
 * @copyright 2018
10
 * @license GNU AGPL version 3 or any later version
11
 *
12
 * This program is free software: you can redistribute it and/or modify
13
 * it under the terms of the GNU Affero General Public License as
14
 * published by the Free Software Foundation, either version 3 of the
15
 * License, or (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU Affero General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU Affero General Public License
23
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
 *
25
 */
26
27
28
namespace OCA\FullTextSearch\Model;
29
30
class ProviderIndexes {
31
32
	/** @var Index[] */
33
	private $indexes;
34
35
36
	public function __construct($indexes) {
37
		$this->indexes = $indexes;
38
	}
39
40
41
	/**
42
	 * @return Index[]
43
	 */
44
	public function getIndexes() {
45
		return $this->indexes;
46
	}
47
48
49
	/**
50
	 * @param string $documentId
51
	 *
52
	 * @return null|Index
53
	 */
54
	public function getIndex($documentId) {
55
		foreach ($this->indexes as $index) {
56
			if ($index->getDocumentId() === (string)$documentId) {
57
				return $index;
58
			}
59
		}
60
61
		return null;
62
	}
63
64
65
}