Code Duplication    Length = 14-14 lines in 2 locations

lib/account.php 2 locations

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