Code Duplication    Length = 14-14 lines in 2 locations

lib/ar/connect/ftp.php 2 locations

@@ 12-25 (lines=14) @@
9
		public static $pasv         = false;
10
		public static $transferMode = FTP_BINARY;
11
12
		public static function get( $url, $options = array() ) {
13
			$path = parse_url($url, PHP_URL_PATH );
14
			if ($path !== false ) {
15
				$fileName = basename($path);
16
				$client = new ar_connect_ftpClient( $url, $options );
17
				if ( !ar_error::isError( $client) ) {
18
					return $client->get( $fileName );
19
				} else {
20
					return $client;
21
				}
22
			} else {
23
				return ar::error( "Could not parse url ".(string)$url, 11);
24
			}
25
		}
26
27
		public static function put( $url, $contents, $options = array() ) {
28
			$path = parse_url( $url, PHP_URL_PATH );
@@ 27-40 (lines=14) @@
24
			}
25
		}
26
27
		public static function put( $url, $contents, $options = array() ) {
28
			$path = parse_url( $url, PHP_URL_PATH );
29
			if ($path !== false ) {
30
				$fileName = basename($path);
31
				$client = new ar_connect_ftpClient($url, $options );
32
				if ( !ar_error::isError( $client ) ) {
33
					return $client->put( $contents, $fileName );
34
				} else {
35
					return $client;
36
				}
37
			} else {
38
				return ar::error( "Could not parse url ".(string)$url, 11);
39
			}
40
		}
41
42
		public static function client( $url = null, $options = array() ) {
43
			return new ar_connect_ftpClient( $url, $options );