Code Duplication    Length = 14-14 lines in 2 locations

lib/account.php 2 locations

@@ 422-435 (lines=14) @@
419
	 *
420
	 * @return Mailbox The best candidate for the "drafts" inbox
421
	 */
422
	public function getDraftsFolder() {
423
		// check for existence
424
		$draftsFolder = $this->getSpecialFolder('drafts', true);
425
		if (count($draftsFolder) === 0) {
426
			// drafts folder does not exist - let's create one
427
			$conn = $this->getImapConnection();
428
			// TODO: also search for translated drafts mailboxes
429
			$conn->createMailbox('Drafts', [
430
				'special_use' => ['drafts'],
431
			]);
432
			return $this->guessBestMailBox($this->listMailboxes('Drafts'));
433
		}
434
		return $draftsFolder[0];
435
	}
436
437
	/**
438
	 * @return IMailBox
@@ 450-463 (lines=14) @@
447
	 *
448
	 * @return Mailbox The best candidate for the "sent mail" inbox
449
	 */
450
	public function getSentFolder() {
451
		//check for existence
452
		$sentFolders = $this->getSpecialFolder('sent', true);
453
		if (count($sentFolders) === 0) {
454
			//sent folder does not exist - let's create one
455
			$conn = $this->getImapConnection();
456
			//TODO: also search for translated sent mailboxes
457
			$conn->createMailbox('Sent', [
458
				'special_use' => ['sent'],
459
			]);
460
			return $this->guessBestMailBox($this->listMailboxes('Sent'));
461
		}
462
		return $sentFolders[0];
463
	}
464
465
	/**
466
	 * @param string $sourceFolderId