Code Duplication    Length = 15-16 lines in 2 locations

lib/carddav/backend.php 2 locations

@@ 97-111 (lines=15) @@
94
95
		$mutations = $propPatch->getRemainingMutations();
96
97
		foreach($mutations as $property=>$newvalue) {
98
			switch($property) {
99
				case '{DAV:}displayname' :
100
					$changes['displayname'] = $newvalue;
101
					break;
102
				case '{' . \Sabre\CardDAV\Plugin::NS_CARDDAV
103
						. '}addressbook-description' :
104
					$changes['description'] = $newvalue;
105
					break;
106
				default :
107
					// If any unsupported values were being updated, we must
108
					// let the entire request fail.
109
					return false;
110
			}
111
		}
112
113
		list($id, $backend) = $this->getBackendForAddressBook($addressbookid);
114
		return $backend->updateAddressBook($id, $changes);
@@ 128-143 (lines=16) @@
125
	 */
126
	public function createAddressBook($principaluri, $uri, array $properties) {
127
128
		foreach($properties as $property => $newvalue) {
129
130
			switch($property) {
131
				case '{DAV:}displayname' :
132
					$properties['displayname'] = $newvalue;
133
					break;
134
				case '{' . \Sabre\CardDAV\Plugin::NS_CARDDAV
135
						. '}addressbook-description' :
136
					$properties['description'] = $newvalue;
137
					break;
138
				default :
139
					throw new \Sabre\DAV\Exception\BadRequest('Unknown property: '
140
						. $property);
141
			}
142
143
		}
144
145
		$properties['uri'] = $uri;
146