Completed
Push — master ( 0c68cd...766ef1 )
by Maxence
02:02
created

FilesDocument   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 167
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 15
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 167
rs 10

14 Methods

Rating   Name   Duplication   Size   Complexity  
A setOwnerId() 0 5 1
A getOwnerId() 0 3 1
A setViewerId() 0 5 1
A getViewerId() 0 3 1
A setType() 0 5 1
A getType() 0 3 1
A setMimetype() 0 5 1
A getMimetype() 0 3 1
A setPath() 0 5 1
A getPath() 0 3 1
A getFilename() 0 3 1
A setFilename() 0 5 1
A __destruct() 0 9 1
A fromIndexDocument() 0 8 2
1
<?php
2
/**
3
 * Files_FullTextSearch - Index the content of your files
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
namespace OCA\Files_FullTextSearch\Model;
28
29
use OCA\FullTextSearch\Model\IndexDocument;
30
31
class FilesDocument extends IndexDocument {
32
33
	const STATUS_FILE_ACCESS = 1024;
34
35
	/** @var string */
36
	private $ownerId;
37
38
	/** @var string */
39
	private $viewerId;
40
41
	/** @var string */
42
	private $type;
43
44
	/** @var string */
45
	private $mimetype;
46
47
	/** @var string */
48
	private $path;
49
50
	/** @var string */
51
	private $filename;
52
53
54
	/**
55
	 * @param string $ownerId
56
	 *
57
	 * @return $this
58
	 */
59
	public function setOwnerId($ownerId) {
60
		$this->ownerId = $ownerId;
61
62
		return $this;
63
	}
64
65
	/**
66
	 * @return string
67
	 */
68
	public function getOwnerId() {
69
		return $this->ownerId;
70
	}
71
72
73
	/**
74
	 * @param string $viewerId
75
	 *
76
	 * @return $this
77
	 */
78
	public function setViewerId($viewerId) {
79
		$this->viewerId = $viewerId;
80
81
		return $this;
82
	}
83
84
	/**
85
	 * @return string
86
	 */
87
	public function getViewerId() {
88
		return $this->viewerId;
89
	}
90
91
92
	/**
93
	 * @param string $type
94
	 *
95
	 * @return $this
96
	 */
97
	public function setType($type) {
98
		$this->type = $type;
99
100
		return $this;
101
	}
102
103
	/**
104
	 * @return string
105
	 */
106
	public function getType() {
107
		return $this->type;
108
	}
109
110
111
	/**
112
	 * @param string $type
113
	 *
114
	 * @return $this
115
	 */
116
	public function setMimetype($type) {
117
		$this->mimetype = $type;
118
119
		return $this;
120
	}
121
122
	/**
123
	 * @return string
124
	 */
125
	public function getMimetype() {
126
		return $this->mimetype;
127
	}
128
129
130
	/**
131
	 * @param string $path
132
	 *
133
	 * @return $this
134
	 */
135
	public function setPath($path) {
136
		$this->path = $path;
137
138
		return $this;
139
	}
140
141
	/**
142
	 * @return string
143
	 */
144
	public function getPath() {
145
		return $this->path;
146
	}
147
148
149
	/**
150
	 * @return string
151
	 */
152
	public function getFilename() {
153
		return $this->filename;
154
	}
155
156
	/**
157
	 * @param string $filename
158
	 *
159
	 * @return FilesDocument
160
	 */
161
	public function setFilename($filename) {
162
		$this->filename = $filename;
163
164
		return $this;
165
	}
166
167
168
	/**
169
	 *
170
	 */
171
	public function __destruct() {
172
		parent::__destruct();
173
174
		unset($this->ownerId);
175
		unset($this->type);
176
		unset($this->source);
177
		unset($this->mimetype);
178
		unset($this->path);
179
	}
180
181
182
	/**
183
	 * @param IndexDocument $indexDocument
184
	 *
185
	 * @return FilesDocument
186
	 */
187
	public static function fromIndexDocument(IndexDocument $indexDocument) {
188
		$document = new FilesDocument($indexDocument->getProviderId(), $indexDocument->getId());
189
		foreach (get_object_vars($indexDocument) as $key => $name) {
190
			$document->$key = $name;
191
		}
192
193
		return $document;
194
	}
195
196
197
}