Code Duplication    Length = 9-10 lines in 3 locations

src/Tartana/Host/Common/Http.php 1 location

@@ 66-75 (lines=10) @@
63
64
		try
65
		{
66
			if (! $this->login())
67
			{
68
				foreach ($downloads as $download)
69
				{
70
					$download->setState(Download::STATE_DOWNLOADING_ERROR);
71
					$download->setMessage('TARTANA_DOWNLOAD_MESSAGE_INVALID_LOGIN');
72
				}
73
				$this->handleCommand(new SaveDownloads($downloads));
74
				return [];
75
			}
76
		}
77
		catch (\Exception $e)
78
		{

src/Tartana/Host/Localhost.php 2 locations

@@ 63-72 (lines=10) @@
60
		foreach ($downloads as $download)
61
		{
62
			$destination = Util::realPath($download->getDestination());
63
			if (empty($destination))
64
			{
65
				$download->setMessage('TARTANA_DOWNLOAD_MESSAGE_INVALID_DESTINATION');
66
				$download->setState(Download::STATE_DOWNLOADING_ERROR);
67
				$this->handleCommand(new SaveDownloads([
68
						$download
69
				]));
70
71
				continue;
72
			}
73
74
			$src = $this->getSourceAdapter($download);
75
			if (empty($src))
@@ 75-83 (lines=9) @@
72
			}
73
74
			$src = $this->getSourceAdapter($download);
75
			if (empty($src))
76
			{
77
				$download->setMessage('TARTANA_DOWNLOAD_MESSAGE_INVALID_PATH');
78
				$download->setState(Download::STATE_DOWNLOADING_ERROR);
79
				$this->handleCommand(new SaveDownloads([
80
						$download
81
				]));
82
				continue;
83
			}
84
85
			$src = new Filesystem($src);
86
			$dest = new Filesystem(new Local($destination));