Code Duplication    Length = 54-54 lines in 2 locations

apps/files_trashbin/lib/Sabre/RestoreFolder.php 1 location

@@ 33-86 (lines=54) @@
30
use Sabre\DAV\INode;
31
32
33
class RestoreFolder implements ICollection, IMoveTarget {
34
35
	/** @var string */
36
	protected $userId;
37
38
	public function __construct(string $userId) {
39
		$this->userId = $userId;
40
	}
41
42
	public function createFile($name, $data = null) {
43
		throw new Forbidden();
44
	}
45
46
	public function createDirectory($name) {
47
		throw new Forbidden();
48
	}
49
50
	public function getChild($name) {
51
		return null;
52
	}
53
54
	public function delete() {
55
		throw new Forbidden();
56
	}
57
58
	public function getName() {
59
		return 'restore';
60
	}
61
62
	public function setName($name) {
63
		throw new Forbidden();
64
	}
65
66
	public function getLastModified(): int {
67
		return 0;
68
	}
69
70
	public function getChildren(): array {
71
		return [];
72
	}
73
74
	public function childExists($name): bool {
75
		return false;
76
	}
77
78
	public function moveInto($targetName, $sourcePath, INode $sourceNode): bool {
79
		if (!($sourceNode instanceof ITrash)) {
80
			return false;
81
		}
82
83
		return $sourceNode->restore();
84
	}
85
86
}
87

apps/files_versions/lib/Sabre/RestoreFolder.php 1 location

@@ 33-86 (lines=54) @@
30
use Sabre\DAV\INode;
31
32
33
class RestoreFolder implements ICollection, IMoveTarget {
34
35
	/** @var string */
36
	protected $userId;
37
38
	public function __construct(string $userId) {
39
		$this->userId = $userId;
40
	}
41
42
	public function createFile($name, $data = null) {
43
		throw new Forbidden();
44
	}
45
46
	public function createDirectory($name) {
47
		throw new Forbidden();
48
	}
49
50
	public function getChild($name) {
51
		return null;
52
	}
53
54
	public function delete() {
55
		throw new Forbidden();
56
	}
57
58
	public function getName() {
59
		return 'restore';
60
	}
61
62
	public function setName($name) {
63
		throw new Forbidden();
64
	}
65
66
	public function getLastModified(): int {
67
		return 0;
68
	}
69
70
	public function getChildren(): array {
71
		return [];
72
	}
73
74
	public function childExists($name): bool {
75
		return false;
76
	}
77
78
	public function moveInto($targetName, $sourcePath, INode $sourceNode): bool {
79
		if (!($sourceNode instanceof VersionFile)) {
80
			return false;
81
		}
82
83
		return $sourceNode->rollBack();
84
	}
85
86
}
87