Code Duplication    Length = 20-20 lines in 2 locations

apps/dav/lib/DAV/MiscCustomPropertiesBackend.php 1 location

@@ 88-107 (lines=20) @@
85
	/**
86
	 * @inheritdoc
87
	 */
88
	protected function getProperties($path, INode $node, array $requestedProperties) {
89
		if (is_null($this->offsetGet($path))) {
90
			// TODO: chunking if more than 1000 properties
91
			$sql = self::SELECT_BY_PATH_STMT;
92
93
			$whereValues = [$path];
94
			$whereTypes = [null];
95
96
			if (!empty($requestedProperties)) {
97
				// request only a subset
98
				$sql .= ' AND `propertyname` in (?)';
99
				$whereValues[] = $requestedProperties;
100
				$whereTypes[] = Connection::PARAM_STR_ARRAY;
101
			}
102
103
			$props = $this->fetchProperties($sql, $whereValues, $whereTypes);
104
			$this->offsetSet($path, $props);
105
		}
106
		return $this->offsetGet($path);
107
	}
108
109
	/**
110
	 * @inheritdoc

apps/dav/lib/DAV/FileCustomPropertiesBackend.php 1 location

@@ 83-102 (lines=20) @@
80
	/**
81
	 * @inheritdoc
82
	 */
83
	protected function getProperties($path, INode $node, array $requestedProperties) {
84
		$fileId = $node->getId();
85
		if (is_null($this->offsetGet($fileId))) {
86
			// TODO: chunking if more than 1000 properties
87
			$sql = self::SELECT_BY_ID_STMT;
88
			$whereValues = [$fileId];
89
			$whereTypes = [null];
90
91
			if (!empty($requestedProperties)) {
92
				// request only a subset
93
				$sql .= ' AND `propertyname` in (?)';
94
				$whereValues[] = $requestedProperties;
95
				$whereTypes[] = Connection::PARAM_STR_ARRAY;
96
			}
97
98
			$props = $this->fetchProperties($sql, $whereValues, $whereTypes);
99
			$this->offsetSet($fileId, $props);
100
		}
101
		return $this->offsetGet($fileId);
102
	}
103
104
	/**
105
	 * @inheritdoc