Code Duplication    Length = 18-22 lines in 3 locations

src/Networks/NetAffiliation.php 1 location

@@ 42-63 (lines=22) @@
39
        $this->login( $this->_username, $this->_password );
40
    }
41
42
    public function login(string $username, string $password): 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
        $credentials = array();
52
        $credentials["user"] = $this->_username;
53
        $credentials["password"] = $this->_password;
54
        $credentials["apiPassword"] = $this->_password;
55
        $this->_network->login( $credentials );
56
        //$this->_apiClient = $this->_network->getApiClient();
57
        if ($this->_network->checkConnection()) {
58
            $this->_logged = true;
59
60
        }
61
62
        return $this->_logged;
63
    }
64
65
    /**
66
     * @return bool

src/Networks/TradeDoubler.php 1 location

@@ 44-64 (lines=21) @@
41
        $this->login( $this->_username, $this->_password );
42
    }
43
44
    public function login(string $username, string $password): bool
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
        $credentials = array();
54
        $credentials["user"] = $this->_username;
55
        $credentials["password"] = $this->_password;
56
        $this->_network->login( $credentials );
57
58
        if ($this->_network->checkConnection()) {
59
            $this->_logged = true;
60
61
        }
62
63
        return $this->_logged;
64
    }
65
66
    /**
67
     * @return bool

src/Networks/WebGains.php 1 location

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