Completed
Push — master ( 3f43c1...51db49 )
by Maxence
03:26
created

FilesDocument::setFilename()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
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
51
	/**
52
	 * @param string $ownerId
53
	 *
54
	 * @return $this
55
	 */
56
	public function setOwnerId($ownerId) {
57
		$this->ownerId = $ownerId;
58
59
		return $this;
60
	}
61
62
	/**
63
	 * @return string
64
	 */
65
	public function getOwnerId() {
66
		return $this->ownerId;
67
	}
68
69
70
	/**
71
	 * @param string $viewerId
72
	 *
73
	 * @return $this
74
	 */
75
	public function setViewerId($viewerId) {
76
		$this->viewerId = $viewerId;
77
78
		return $this;
79
	}
80
81
	/**
82
	 * @return string
83
	 */
84
	public function getViewerId() {
85
		return $this->viewerId;
86
	}
87
88
89
	/**
90
	 * @param string $type
91
	 *
92
	 * @return $this
93
	 */
94
	public function setType($type) {
95
		$this->type = $type;
96
97
		return $this;
98
	}
99
100
	/**
101
	 * @return string
102
	 */
103
	public function getType() {
104
		return $this->type;
105
	}
106
107
108
	/**
109
	 * @param string $type
110
	 *
111
	 * @return $this
112
	 */
113
	public function setMimetype($type) {
114
		$this->mimetype = $type;
115
116
		return $this;
117
	}
118
119
	/**
120
	 * @return string
121
	 */
122
	public function getMimetype() {
123
		return $this->mimetype;
124
	}
125
126
127
	/**
128
	 * @param string $path
129
	 *
130
	 * @return $this
131
	 */
132
	public function setPath($path) {
133
		$this->path = $path;
134
135
		return $this;
136
	}
137
138
	/**
139
	 * @return string
140
	 */
141
	public function getPath() {
142
		return $this->path;
143
	}
144
145
146
147
	/**
148
	 *
149
	 */
150
	public function __destruct() {
151
		parent::__destruct();
152
153
		unset($this->ownerId);
154
		unset($this->type);
155
		unset($this->source);
156
		unset($this->mimetype);
157
		unset($this->path);
158
	}
159
160
161
	/**
162
	 * @param IndexDocument $indexDocument
163
	 *
164
	 * @return FilesDocument
165
	 */
166
	public static function fromIndexDocument(IndexDocument $indexDocument) {
167
		$document = new FilesDocument($indexDocument->getProviderId(), $indexDocument->getId());
168
		foreach (get_object_vars($indexDocument) as $key => $name) {
169
			$document->$key = $name;
170
		}
171
172
		return $document;
173
	}
174
175
176
}