Code Duplication    Length = 7-7 lines in 7 locations

apps/user_ldap/lib/wizard.php 7 locations

@@ 185-191 (lines=7) @@
182
	 * @return int|bool
183
	 */
184
	public function countUsersWithAttribute($attr, $existsCheck = false) {
185
		if(!$this->checkRequirements(array('ldapHost',
186
										   'ldapPort',
187
										   'ldapBase',
188
										   'ldapUserFilter',
189
										   ))) {
190
			return  false;
191
		}
192
193
		$filter = $this->access->combineFilterWithAnd(array(
194
			$this->configuration->ldapUserFilter,
@@ 210-216 (lines=7) @@
207
	 * @throws \Exception
208
	 */
209
	public function detectUserDisplayNameAttribute() {
210
		if(!$this->checkRequirements(array('ldapHost',
211
										'ldapPort',
212
										'ldapBase',
213
										'ldapUserFilter',
214
										))) {
215
			return  false;
216
		}
217
218
		$attr = $this->configuration->ldapUserDisplayName;
219
		if($attr !== 'displayName' && !empty($attr)) {
@@ 252-258 (lines=7) @@
249
	 * @return WizardResult|bool
250
	 */
251
	public function detectEmailAttribute() {
252
		if(!$this->checkRequirements(array('ldapHost',
253
										   'ldapPort',
254
										   'ldapBase',
255
										   'ldapUserFilter',
256
										   ))) {
257
			return  false;
258
		}
259
260
		$attr = $this->configuration->ldapEmailAttribute;
261
		if(!empty($attr)) {
@@ 299-305 (lines=7) @@
296
	 * @throws \Exception
297
	 */
298
	public function determineAttributes() {
299
		if(!$this->checkRequirements(array('ldapHost',
300
										   'ldapPort',
301
										   'ldapBase',
302
										   'ldapUserFilter',
303
										   ))) {
304
			return  false;
305
		}
306
307
		$attributes = $this->getUserAttributes();
308
@@ 328-334 (lines=7) @@
325
	 * @throws \Exception
326
	 */
327
	private function getUserAttributes() {
328
		if(!$this->checkRequirements(array('ldapHost',
329
										   'ldapPort',
330
										   'ldapBase',
331
										   'ldapUserFilter',
332
										   ))) {
333
			return  false;
334
		}
335
		$cr = $this->getConnection();
336
		if(!$cr) {
337
			throw new \Exception('Could not connect to LDAP');
@@ 593-599 (lines=7) @@
590
	 * @throws \Exception
591
	 */
592
	public function getUserLoginFilter() {
593
		if(!$this->checkRequirements(array('ldapHost',
594
										   'ldapPort',
595
										   'ldapBase',
596
										   'ldapUserFilter',
597
										   ))) {
598
			return false;
599
		}
600
601
		$filter = $this->composeLdapFilter(self::LFILTER_LOGIN);
602
		if(!$filter) {
@@ 616-622 (lines=7) @@
613
	 * @throws \Exception
614
	 */
615
	public function testLoginName($loginName) {
616
		if(!$this->checkRequirements(array('ldapHost',
617
			'ldapPort',
618
			'ldapBase',
619
			'ldapLoginFilter',
620
		))) {
621
			return false;
622
		}
623
624
		$cr = $this->access->connection->getConnectionResource();
625
		if(!$this->ldap->isResource($cr)) {