Code Duplication    Length = 14-14 lines in 2 locations

lib/account.php 2 locations

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