Completed
Push — master ( c84332...f751a3 )
by Phil
09:54
created

File::putContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author Jörn Friedrich Dreyer <[email protected]>
4
 *
5
 * @copyright Copyright (c) 2018, ownCloud GmbH
6
 * @license AGPL-3.0
7
 *
8
 * This code is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Affero General Public License, version 3,
10
 * as published by the Free Software Foundation.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
 * GNU Affero General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Affero General Public License, version 3,
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
19
 *
20
 */
21
22
namespace OC\Files\Storage;
23
24
use OCP\Files\File as FilesFile;
25
26
class File extends Node implements FilesFile {
27
28
	/**
29
	 * @inheritdoc
30
	 */
31
	public function getContent() {
32
		return $this->storage->file_get_contents($this->path);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The expression $this->storage->file_get_contents($this->path); of type string|false adds false to the return on line 32 which is incompatible with the return type declared by the interface OCP\Files\File::getContent of type string. It seems like you forgot to handle an error condition.
Loading history...
33
	}
34
35
	/**
36
	 * @inheritdoc
37
	 */
38
	public function putContent($data) {
39
		$this->storage->file_put_contents($this->path, $data);
40
	}
41
42
	/**
43
	 * @inheritdoc
44
	 */
45
	public function fopen($mode) {
46
		return $this->storage->fopen($this->path, $mode);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The expression $this->storage->fopen($this->path, $mode); of type resource|false adds false to the return on line 46 which is incompatible with the return type declared by the interface OCP\Files\File::fopen of type resource. It seems like you forgot to handle an error condition.
Loading history...
47
	}
48
49
	/**
50
	 * @inheritdoc
51
	 */
52
	public function delete() {
53
		$this->storage->unlink($this->path);
54
	}
55
56
	/**
57
	 * @inheritdoc
58
	 */
59
	public function hash($type, $raw = false) {
60
		return $this->storage->hash($type, $this->path, $raw);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The expression $this->storage->hash($type, $this->path, $raw); of type string|false adds false to the return on line 60 which is incompatible with the return type declared by the interface OCP\Files\File::hash of type string. It seems like you forgot to handle an error condition.
Loading history...
61
	}
62
}
63