Code Duplication    Length = 22-25 lines in 2 locations

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/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