Code Duplication    Length = 14-14 lines in 2 locations

lib/account.php 2 locations

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