Code Duplication    Length = 18-25 lines in 5 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/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/Ebay.php 1 location

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