Completed
Push — master ( ff3e8c...ea9b1c )
by Lukas
13:22 queued 02:44
created

SimpleFile::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * @copyright 2016 Roeland Jago Douma <[email protected]>
4
 *
5
 * @author Roeland Jago Douma <[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
namespace OC\Files\SimpleFS;
24
25
use OCP\Files\File;
26
use OCP\Files\NotPermittedException;
27
use OCP\Files\SimpleFS\ISimpleFile;
28
29
class SimpleFile implements ISimpleFile  {
30
31
	/** @var File $file */
32
	private $file;
33
34
	/**
35
	 * File constructor.
36
	 *
37
	 * @param File $file
38
	 */
39
	public function __construct(File $file) {
40
		$this->file = $file;
41
	}
42
43
	/**
44
	 * Get the name
45
	 *
46
	 * @return string
47
	 */
48
	public function getName() {
49
		return $this->file->getName();
50
	}
51
52
	/**
53
	 * Get the size in bytes
54
	 *
55
	 * @return int
56
	 */
57
	public function getSize() {
58
		return $this->file->getSize();
59
	}
60
61
	/**
62
	 * Get the ETag
63
	 *
64
	 * @return string
65
	 */
66
	public function getETag() {
67
		return $this->file->getEtag();
68
	}
69
70
	/**
71
	 * Get the last modification time
72
	 *
73
	 * @return int
74
	 */
75
	public function getMTime() {
76
		return $this->file->getMTime();
77
	}
78
79
	/**
80
	 * Get the content
81
	 *
82
	 * @return string
83
	 */
84
	public function getContent() {
85
		return $this->file->getContent();
86
	}
87
88
	/**
89
	 * Overwrite the file
90
	 *
91
	 * @param string $data
92
	 * @throws NotPermittedException
93
	 */
94
	public function putContent($data) {
95
		$this->file->putContent($data);
96
	}
97
98
	/**
99
	 * Delete the file
100
	 *
101
	 * @throws NotPermittedException
102
	 */
103
	public function delete() {
104
		$this->file->delete();
105
	}
106
107
	/**
108
	 * Get the MimeType
109
	 *
110
	 * @return string
111
	 */
112
	public function getMimeType() {
113
		return $this->file->getMimeType();
114
	}
115
}
116