Code Duplication    Length = 13-14 lines in 2 locations

lib/backend/abstractbackend.php 2 locations

@@ 93-105 (lines=13) @@
90
	* Returns the supported actions as an int to be
91
	* compared with \OCP\PERMISSION_CREATE etc.
92
	*/
93
	protected function getContactPermissions() {
94
		$permissions = 0;
95
96
		foreach ($this->possibleContactPermissions as $permission => $methodName) {
97
			if(method_exists($this, $methodName)) {
98
				$permissions |= $permission;
99
			}
100
101
		}
102
103
		//\OCP\Util::writeLog('contacts', __METHOD__.', permissions' . $permissions, \OCP\Util::DEBUG);
104
		return $permissions;
105
	}
106
107
	/**
108
	* @brief Get all permissions for address book based on what the backend implements.
@@ 114-127 (lines=14) @@
111
	* Returns the supported actions as int to be
112
	* compared with \OCP\PERMISSION_CREATE etc.
113
	*/
114
	protected function getAddressBookPermissions() {
115
116
		$permissions = 0;
117
118
		foreach ($this->possibleAddressBookPermissions as $permission => $methodName) {
119
			if (method_exists($this, $methodName)) {
120
				$permissions |= $permission;
121
			}
122
123
		}
124
125
		//\OCP\Util::writeLog('contacts', __METHOD__.', permissions' . $permissions, \OCP\Util::DEBUG);
126
		return $permissions;
127
	}
128
129
	/**
130
	* @brief Check if backend implements action for contacts