Passed
Push — master ( 9e596d...9f70c6 )
by Christoph
15:44 queued 10s
created

RestoreTarget::getLastModified()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * @copyright 2021 Christoph Wurst <[email protected]>
7
 *
8
 * @author 2021 Christoph Wurst <[email protected]>
9
 *
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
namespace OCA\DAV\CalDAV\Trashbin;
27
28
use OCA\DAV\CalDAV\IRestorable;
29
use Sabre\DAV\Exception\Forbidden;
30
use Sabre\DAV\Exception\NotFound;
31
use Sabre\DAV\ICollection;
32
use Sabre\DAV\IMoveTarget;
33
use Sabre\DAV\INode;
34
35
class RestoreTarget implements ICollection, IMoveTarget {
36
	public const NAME = 'restore';
37
38
	public function createFile($name, $data = null) {
39
		throw new Forbidden();
40
	}
41
42
	public function createDirectory($name) {
43
		throw new Forbidden();
44
	}
45
46
	public function getChild($name) {
47
		throw new NotFound();
48
	}
49
50
	public function getChildren(): array {
51
		return [];
52
	}
53
54
	public function childExists($name): bool {
55
		return false;
56
	}
57
58
	public function moveInto($targetName, $sourcePath, INode $sourceNode): bool {
59
		if ($sourceNode instanceof IRestorable) {
60
			$sourceNode->restore();
61
			return true;
62
		}
63
64
		return false;
65
	}
66
67
	public function delete() {
68
		throw new Forbidden();
69
	}
70
71
	public function getName(): string {
72
		return 'restore';
73
	}
74
75
	public function setName($name) {
76
		throw new Forbidden();
77
	}
78
79
	public function getLastModified() {
80
		return 0;
81
	}
82
}
83