Code Duplication    Length = 14-14 lines in 2 locations

lib/account.php 2 locations

@@ 386-399 (lines=14) @@
383
	 *
384
	 * @return Mailbox The best candidate for the "drafts" inbox
385
	 */
386
	public function getDraftsFolder() {
387
		// check for existence
388
		$draftsFolder = $this->getSpecialFolder('drafts', true);
389
		if (count($draftsFolder) === 0) {
390
			// drafts folder does not exist - let's create one
391
			$conn = $this->getImapConnection();
392
			// TODO: also search for translated drafts mailboxes
393
			$conn->createMailbox('Drafts', [
394
				'special_use' => ['drafts'],
395
			]);
396
			return $this->guessBestMailBox($this->listMailboxes('Drafts'));
397
		}
398
		return $draftsFolder[0];
399
	}
400
401
	/**
402
	 * @return IMailBox
@@ 414-427 (lines=14) @@
411
	 *
412
	 * @return Mailbox The best candidate for the "sent mail" inbox
413
	 */
414
	public function getSentFolder() {
415
		//check for existence
416
		$sentFolders = $this->getSpecialFolder('sent', true);
417
		if (count($sentFolders) === 0) {
418
			//sent folder does not exist - let's create one
419
			$conn = $this->getImapConnection();
420
			//TODO: also search for translated sent mailboxes
421
			$conn->createMailbox('Sent', [
422
				'special_use' => ['sent'],
423
			]);
424
			return $this->guessBestMailBox($this->listMailboxes('Sent'));
425
		}
426
		return $sentFolders[0];
427
	}
428
429
	/**
430
	 * @param string $sourceFolderId