Code Duplication    Length = 14-14 lines in 2 locations

lib/account.php 2 locations

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