lftp/Plugin.php
public function parseFtpString($ftpUrl)
    {
        if(is_null($this->ftpUsername)){
            if(preg_match('/^(?:ftp:\/\/)?([^:]+):([^@]+)@(.*)$/',$ftpUrl,$matches)){
                $this->ftpUsername = $matches[1];
                $this->ftpPassword = $matches[2];
                $this->ftpDomain   = $matches[3];
            }else{
                throw new \Exception('Ftp string in wrong format, use [ftp://]username:password@domain.com');
            }
        }
    }
public function parseFtpString($ftpUrl)
    {
        if(is_null($this->ftpUsername)){
            if(preg_match('/^(?:ftp:\/\/)?([^:]+):([^@]+)@(.*)$/',$ftpUrl,$matches)){
                $this->ftpUsername = $matches[1];
                $this->ftpPassword = $matches[2];
                $this->ftpDomain   = $matches[3];
            }else{
                throw new \Exception('Ftp string in wrong format, use [ftp://]username:password@domain.com');
            }
        }
    }
public function parseFtpString ( $ ftpUrl ) { if ( is_null ( $ this -> ftpUsername ) ) { if ( preg_match ( '/^(?:ftp:\/\/)?([^:]+):([^@]+)@(.*)$/' , $ ftpUrl , $ matches ) ) { $ this -> ftpUsername = $ matches [ 1 ] ; $ this -> ftpPassword = $ matches [ 2 ] ; $ this -> ftpDomain = $ matches [ 3 ] ; } else { throw new \ Exception ( 'Ftp string in wrong format, use [ftp://]username:password@domain.com' ) ; } } }
helper function to
set local vars

@param $ftpUrl
@throws \Exception
helper function to set local vars