Code Duplication    Length = 13-15 lines in 3 locations

src/WHM/Accounts.php 3 locations

@@ 898-912 (lines=15) @@
895
     * @throws ClientExceptions
896
     * @throws Exception
897
     */
898
    public function remove($username, $keepDNS = false)
899
    {
900
        $params = ['user' => $username, 'keepdns' => (int) $keepDNS];
901
        $result = $this->client->sendRequest("/json-api/removeacct", "GET", $params);
902
903
        if(!empty($result['metadata']) && $result['metadata']['result'] === 0){
904
            throw new ClientExceptions($result['metadata']['reason']);
905
        }
906
907
        if(!empty($result['metadata']) && $result['metadata']['result'] === 1){
908
            return true;
909
        }
910
911
        return false;
912
    }
913
914
    /**
915
     * This function retrieves account bandwidth information.
@@ 1016-1030 (lines=15) @@
1013
     * @throws ClientExceptions
1014
     * @throws Exception
1015
     */
1016
    public function unsuspend($user)
1017
    {
1018
        $params = ['user' => $user];
1019
        $result = $this->client->sendRequest("/json-api/unsuspendacct", "GET", $params);
1020
1021
        if(!empty($result['metadata']) && $result['metadata']['result'] === 0){
1022
            throw new ClientExceptions($result['metadata']['reason']);
1023
        }
1024
1025
        if(!empty($result['metadata']) && $result['metadata']['result'] === 1){
1026
            return true;
1027
        }
1028
1029
        return false;
1030
    }
1031
1032
    /**
1033
     * This function checks for username conflicts during account creation.
@@ 1043-1055 (lines=13) @@
1040
     * @throws ClientExceptions
1041
     * @throws Exception
1042
     */
1043
    public function validateNewUsername($username)
1044
    {
1045
        $params = ['user' => $username];
1046
        $result = $this->client->sendRequest("/json-api/verify_new_username", "GET", $params);
1047
1048
        if(!empty($result['metadata']) && $result['metadata']['result'] === 0){
1049
            throw new ClientExceptions($result['metadata']['reason']);
1050
        }
1051
1052
        if(!empty($result['metadata']) && $result['metadata']['result'] === 1){
1053
            return true;
1054
        }
1055
    }
1056
1057
    /**
1058
     * This generates a URL for one-click login to cPanel.