Code Duplication    Length = 6-19 lines in 3 locations

apps/user_ldap/lib/Mapping/AbstractMapping.php 1 location

@@ 231-240 (lines=10) @@
228
	 * @return bool
229
	 */
230
	public function map($fdn, $name, $uuid) {
231
		if(mb_strlen($fdn) > 255) {
232
			\OC::$server->getLogger()->error(
233
				'Cannot map, because the DN exceeds 255 characters: {dn}',
234
				[
235
					'app' => 'user_ldap',
236
					'dn' => $fdn,
237
				]
238
			);
239
			return false;
240
		}
241
242
		$row = array(
243
			'ldap_dn'        => $fdn,

apps/user_ldap/lib/User_LDAP.php 1 location

@@ 351-356 (lines=6) @@
348
	*/
349
	public function deleteUser($uid) {
350
		$marked = $this->ocConfig->getUserValue($uid, 'user_ldap', 'isDeleted', 0);
351
		if(intval($marked) === 0) {
352
			\OC::$server->getLogger()->notice(
353
				'User '.$uid . ' is not marked as deleted, not cleaning up.',
354
				array('app' => 'user_ldap'));
355
			return false;
356
		}
357
		\OC::$server->getLogger()->info('Cleaning up after user ' . $uid,
358
			array('app' => 'user_ldap'));
359

apps/user_ldap/lib/Access.php 1 location

@@ 1626-1644 (lines=19) @@
1623
			throw new \InvalidArgumentException('String expected');
1624
		}
1625
		$blocks = explode('-', $guid);
1626
		if(count($blocks) !== 5) {
1627
			/*
1628
			 * Why not throw an Exception instead? This method is a utility
1629
			 * called only when trying to figure out whether a "missing" known
1630
			 * LDAP user was or was not renamed on the LDAP server. And this
1631
			 * even on the use case that a reverse lookup is needed (UUID known,
1632
			 * not DN), i.e. when finding users (search dialog, users page,
1633
			 * login, …) this will not be fired. This occurs only if shares from
1634
			 * a users are supposed to be mounted who cannot be found. Throwing
1635
			 * an exception here would kill the experience for a valid, acting
1636
			 * user. Instead we write a log message.
1637
			 */
1638
			\OC::$server->getLogger()->info(
1639
				'Passed string does not resemble a valid GUID. Known UUID ' .
1640
				'({uuid}) probably does not match UUID configuration.',
1641
				[ 'app' => 'user_ldap', 'uuid' => $guid ]
1642
			);
1643
			return $guid;
1644
		}
1645
		for($i=0; $i < 3; $i++) {
1646
			$pairs = str_split($blocks[$i], 2);
1647
			$pairs = array_reverse($pairs);