Code Duplication    Length = 8-8 lines in 2 locations

lib/service/autoconfig/autoconfig.php 2 locations

@@ 118-125 (lines=8) @@
115
					if ($imap['socketType'] === 'STARTTLS') {
116
						$encryptionProtocol = 'tls';
117
					}
118
					if ($imap['username'] === '%EMAILADDRESS%') {
119
						$user = $email;
120
					} elseif ($imap['username'] === '%EMAILLOCALPART%') {
121
						list($user, ) = explode("@", $email);
122
					} else {
123
						$this->logger->info("Unknown username variable: " . $imap['username']);
124
						return null;
125
					}
126
					try {
127
						$account = $this->imapConnector->connect($email, $password, $name, $host,
128
							$port, $encryptionProtocol, $user);
@@ 139-146 (lines=8) @@
136
			if (!is_null($account)) {
137
				foreach ($ispdb['smtp'] as $smtp) {
138
					try {
139
						if ($smtp['username'] === '%EMAILADDRESS%') {
140
							$user = $email;
141
						} elseif ($smtp['username'] === '%EMAILLOCALPART%') {
142
							list($user, ) = explode("@", $email);
143
						} else {
144
							$this->logger->info("Unknown username variable: " . $smtp['username']);
145
							return null;
146
						}
147
148
						$account->setOutboundHost($smtp['hostname']);
149
						$account->setOutboundPort($smtp['port']);