Code Duplication    Length = 14-14 lines in 2 locations

lib/account.php 2 locations

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