Code Duplication    Length = 18-25 lines in 11 locations

src/Networks/Daisycon.php 1 location

@@ 42-59 (lines=18) @@
39
        $this->login( $this->_username, $this->_password, $idSite );
40
    }
41
42
    public function login(string $username, string $password,string $idSite=''): bool{
43
        $this->_logged = false;
44
        if (isNullOrEmpty( $username ) || isNullOrEmpty( $password )) {
45
46
            return false;
47
        }
48
        $this->_username = $username;
49
        $this->_password = $password;
50
        $credentials = array();
51
        $credentials["user"] = $this->_username;
52
        $credentials["password"] = $this->_password;
53
        $credentials["idSite"] = $idSite;
54
        $this->_network->login($credentials);
55
        if ($this->_network->checkConnection()) {
56
            $this->_logged = true;
57
        }
58
        return $this->_logged;
59
    }
60
61
    /**
62
     * @return bool

src/Networks/Ebay.php 1 location

@@ 61-82 (lines=22) @@
58
        }
59
    }
60
61
    public function login(string $username, string $password,string $idSite=''): bool{
62
        $this->_logged = false;
63
        if (isNullOrEmpty( $username ) || isNullOrEmpty( $password )) {
64
65
            return false;
66
        }
67
        $this->_username = $username;
68
        $this->_password = $password;
69
        if (trim($idSite)!=''){
70
            // Ebay needs Site to filter countries
71
            $this->addAllowedSite($idSite);
72
        }
73
        $credentials = array();
74
        $credentials["user"] = $this->_username;
75
        $credentials["password"] = $this->_password;
76
        $this->_network->login($credentials);
77
        if ($this->_network->checkConnection()) {
78
            $this->_logged = true;
79
        }
80
81
        return $this->_logged;
82
    }
83
84
    /**
85
     * @return bool

src/Networks/LinkShare.php 1 location

@@ 43-61 (lines=19) @@
40
        $this->login( $this->_username, $this->_password, $idSite );
41
    }
42
    
43
    public function login(string $username, string $password,string $idSite=''): bool{
44
        $this->_logged = false;
45
        if (isNullOrEmpty( $username ) || isNullOrEmpty( $password )) {
46
47
            return false;
48
        }
49
        $this->_username = $username;
50
        $this->_password = $password;
51
        $credentials = array();
52
        $credentials["user"] = $this->_username;
53
        $credentials["password"] = $this->_password;
54
        $credentials["idSite"] = $idSite;
55
        $this->_network->login($credentials);
56
        if ($this->_network->checkConnection()) {
57
            $this->_logged = true;
58
        }
59
60
        return $this->_logged;
61
    }
62
63
    /**
64
     * @return bool

src/Networks/NetAffiliation.php 1 location

@@ 55-79 (lines=25) @@
52
        }
53
    }
54
55
    public function login(string $username, string $password,string $idSite=''): bool
56
    {
57
        if (trim($idSite)!=''){
58
            $this->addAllowedSite($idSite);
59
        }
60
        $this->_logged = false;
61
        if (isNullOrEmpty( $username ) || isNullOrEmpty( $password )) {
62
63
            return false;
64
        }
65
        $this->_username = $username;
66
        $this->_password = $password;
67
        $credentials = array();
68
        $credentials["user"] = $this->_username;
69
        $credentials["password"] = $this->_password;
70
        $credentials["apiPassword"] = $this->_password;
71
        $this->_network->login( $credentials );
72
        //$this->_apiClient = $this->_network->getApiClient();
73
        if ($this->_network->checkConnection()) {
74
            $this->_logged = true;
75
76
        }
77
78
        return $this->_logged;
79
    }
80
81
    /**
82
     * @return bool

src/Networks/WebGains.php 1 location

@@ 50-68 (lines=19) @@
47
        $this->login( $this->_username, $this->_password, $this->_idSite);
48
    }
49
50
    public function login(string $username, string $password, string $idSite = ''): bool{
51
        $this->_logged = false;
52
        if (isNullOrEmpty( $username ) || isNullOrEmpty( $password )) {
53
54
            return false;
55
        }
56
        $this->_username = $username;
57
        $this->_password = $password;
58
        $this->_idSite = $idSite;
59
        $credentials = array();
60
        $credentials["user"] = $this->_username;
61
        $credentials["password"] = $this->_password;
62
        $this->_network->login($credentials);
63
        if ($this->_network->checkConnection()) {
64
            $this->_logged = true;
65
        }
66
67
        return $this->_logged;
68
    }
69
70
    /**
71
     * @return bool

src/Networks/Admitad.php 1 location

@@ 43-62 (lines=20) @@
40
        $this->login( $this->_username, $this->_password, $idSite );
41
    }
42
43
    public function login(string $username, string $password,string $idSite=''): bool{
44
        $this->_logged = false;
45
        if (isNullOrEmpty( $username ) || isNullOrEmpty( $password )) {
46
47
            return false;
48
        }
49
        $this->_username = $username;
50
        $this->_password = $password;
51
        $this->_idSite = $idSite;
52
        $credentials = array();
53
        $credentials["user"] = $this->_username;
54
        $credentials["password"] = $this->_password;
55
        $credentials["idSite"] = $this->_idSite;
56
        $this->_network->login($credentials);
57
        if ($this->_network->checkConnection()) {
58
            $this->_logged = true;
59
        }
60
61
        return $this->_logged;
62
    }
63
64
    /**
65
     * @return bool

src/Networks/TradeDoubler.php 1 location

@@ 51-73 (lines=23) @@
48
        $this->login( $this->_username, $this->_password, $this->_idSite );
49
    }
50
51
    public function login(string $username, string $password, string $idSite = ''): bool
52
    {
53
        $this->_logged = false;
54
        if (isNullOrEmpty( $username ) || isNullOrEmpty( $password )) {
55
56
            return false;
57
        }
58
        $this->_username = $username;
59
        $this->_password = $password;
60
        $this->_idSite = $idSite;
61
        $credentials = array();
62
        $credentials["user"] = $this->_username;
63
        $credentials["password"] = $this->_password;
64
        $credentials["idSite"] = $this->_idSite;
65
        $this->_network->login( $credentials );
66
67
        if ($this->_network->checkConnection()) {
68
            $this->_logged = true;
69
70
        }
71
72
        return $this->_logged;
73
    }
74
75
    /**
76
     * @return bool

src/Networks/ShareASale.php 1 location

@@ 43-64 (lines=22) @@
40
        $this->login($this->_username, $this->_password, $idSite);
41
    }
42
43
    public function login(string $username, string $password, string $idSite = ''): bool
44
    {
45
46
        $this->_logged = false;
47
        if (isNullOrEmpty($username) || isNullOrEmpty($password)) {
48
49
            return false;
50
        }
51
        $this->_username = $username;
52
        $this->_password = $password;
53
        $this->_idSite = $idSite;
54
        $credentials = array();
55
        $credentials["apiToken"] = $this->_username;
56
        $credentials["apiSecret"] = $this->_password;
57
        $credentials["affiliateId"] = $this->_idSite;
58
        $this->_network->login($credentials);
59
60
        if ($this->_network->checkConnection()) {
61
            $this->_logged = true;
62
        }
63
64
        return $this->_logged;
65
    }
66
67
    /**

src/Networks/AdCell.php 1 location

@@ 42-61 (lines=20) @@
39
        $this->login( $this->_username, $this->_password, $idSite );
40
    }
41
42
    public function login(string $username, string $password,string $idSite=''): bool{
43
        $this->_logged = false;
44
        if (isNullOrEmpty( $username ) || isNullOrEmpty( $password )) {
45
46
            return false;
47
        }
48
        $this->_username = $username;
49
        $this->_password = $password;
50
        $this->_idSite = $idSite;
51
        $credentials = array();
52
        $credentials["user"] = $this->_username;
53
        $credentials["password"] = $this->_password;
54
        $credentials["idSite"] = $this->_idSite;
55
        $this->_network->login($credentials);
56
        if ($this->_network->checkConnection()) {
57
            $this->_logged = true;
58
        }
59
60
        return $this->_logged;
61
    }
62
63
    /**
64
     * @return bool

src/Networks/EasyMarketing.php 1 location

@@ 42-62 (lines=21) @@
39
        $this->login($this->_username, $this->_password, $this->_idSite);
40
    }
41
42
    public function login(string $username, string $password, string $idSite = ''): bool
43
    {
44
        $this->_logged = false;
45
        if (isNullOrEmpty($username) || isNullOrEmpty($password)) {
46
47
            return false;
48
        }
49
        $this->_username = $username;
50
        $this->_password = $password;
51
        $this->_idSite = $idSite;
52
        $credentials = array();
53
        $credentials["user"] = $this->_username;
54
        $credentials["password"] = $this->_password;
55
        $credentials["idSite"] = $this->_idSite;
56
        $this->_network->login($credentials);
57
        if ($this->_network->checkConnection()) {
58
            $this->_logged = true;
59
        }
60
61
        return $this->_logged;
62
    }
63
64
    /**
65
     * @return bool

src/Networks/TradeDoublerWhitelabel.php 1 location

@@ 51-73 (lines=23) @@
48
        $this->login( $this->_username, $this->_password );
49
    }
50
51
    public function login(string $username, string $password, string $idSite = ''): bool
52
    {
53
        $this->_logged = false;
54
        if (isNullOrEmpty( $username ) || isNullOrEmpty( $password )) {
55
56
            return false;
57
        }
58
        $this->_username = $username;
59
        $this->_password = $password;
60
        $this->_idSite = $idSite;
61
        $credentials = array();
62
        $credentials["user"] = $this->_username;
63
        $credentials["password"] = $this->_password;
64
        $credentials["idSite"] = $this->_idSite;
65
        $this->_network->login( $credentials );
66
67
        if ($this->_network->checkConnection()) {
68
            $this->_logged = true;
69
70
        }
71
72
        return $this->_logged;
73
    }
74
75
    /**
76
     * @return bool