Code Duplication    Length = 14-14 lines in 2 locations

lib/account.php 2 locations

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