Code Duplication    Length = 14-14 lines in 2 locations

lib/account.php 2 locations

@@ 390-403 (lines=14) @@
387
	 *
388
	 * @return Mailbox The best candidate for the "drafts" inbox
389
	 */
390
	public function getDraftsFolder() {
391
		// check for existence
392
		$draftsFolder = $this->getSpecialFolder('drafts', true);
393
		if (count($draftsFolder) === 0) {
394
			// drafts folder does not exist - let's create one
395
			$conn = $this->getImapConnection();
396
			// TODO: also search for translated drafts mailboxes
397
			$conn->createMailbox('Drafts', [
398
				'special_use' => ['drafts'],
399
			]);
400
			return $this->guessBestMailBox($this->listMailboxes('Drafts'));
401
		}
402
		return $draftsFolder[0];
403
	}
404
405
	/**
406
	 * @return IMailBox
@@ 418-431 (lines=14) @@
415
	 *
416
	 * @return Mailbox The best candidate for the "sent mail" inbox
417
	 */
418
	public function getSentFolder() {
419
		//check for existence
420
		$sentFolders = $this->getSpecialFolder('sent', true);
421
		if (count($sentFolders) === 0) {
422
			//sent folder does not exist - let's create one
423
			$conn = $this->getImapConnection();
424
			//TODO: also search for translated sent mailboxes
425
			$conn->createMailbox('Sent', [
426
				'special_use' => ['sent'],
427
			]);
428
			return $this->guessBestMailBox($this->listMailboxes('Sent'));
429
		}
430
		return $sentFolders[0];
431
	}
432
433
	/**
434
	 * @param string $sourceFolderId