Code Duplication    Length = 14-14 lines in 2 locations

lib/account.php 2 locations

@@ 397-410 (lines=14) @@
394
	 *
395
	 * @return Mailbox The best candidate for the "drafts" inbox
396
	 */
397
	public function getDraftsFolder() {
398
		// check for existence
399
		$draftsFolder = $this->getSpecialFolder('drafts', true);
400
		if (count($draftsFolder) === 0) {
401
			// drafts folder does not exist - let's create one
402
			$conn = $this->getImapConnection();
403
			// TODO: also search for translated drafts mailboxes
404
			$conn->createMailbox('Drafts', [
405
				'special_use' => ['drafts'],
406
			]);
407
			return $this->guessBestMailBox($this->listMailboxes('Drafts'));
408
		}
409
		return $draftsFolder[0];
410
	}
411
412
	/**
413
	 * @return IMailBox
@@ 425-438 (lines=14) @@
422
	 *
423
	 * @return Mailbox The best candidate for the "sent mail" inbox
424
	 */
425
	public function getSentFolder() {
426
		//check for existence
427
		$sentFolders = $this->getSpecialFolder('sent', true);
428
		if (count($sentFolders) === 0) {
429
			//sent folder does not exist - let's create one
430
			$conn = $this->getImapConnection();
431
			//TODO: also search for translated sent mailboxes
432
			$conn->createMailbox('Sent', [
433
				'special_use' => ['sent'],
434
			]);
435
			return $this->guessBestMailBox($this->listMailboxes('Sent'));
436
		}
437
		return $sentFolders[0];
438
	}
439
440
	/**
441
	 * @param string $sourceFolderId