Code Duplication    Length = 15-15 lines in 3 locations

src/WHM/Accounts.php 3 locations

@@ 582-596 (lines=15) @@
579
     * @throws ClientExceptions
580
     * @throws Exception
581
     */
582
    public function setDigestAuth($user, $password, $enableDigestAuth = true)
583
    {
584
        $params = ['user' => $user, 'password' => $password, 'digestauth' => (int) $enableDigestAuth];
585
        $result = $this->client->sendRequest("/json-api/set_digest_auth", "GET", $params);
586
587
        if(!empty($result['metadata']) && $result['metadata']['result'] === 0){
588
            throw new ClientExceptions($result['metadata']['reason']);
589
        }
590
591
        if(!empty($result['metadata']) && $result['metadata']['result'] === 1){
592
            return true;
593
        }
594
595
        return false;
596
    }
597
598
    /**
599
     * This function checks whether a cPanel user's home directory contains a valid .my.cnf file.
@@ 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.
@@ 989-1003 (lines=15) @@
986
     * @throws ClientExceptions
987
     * @throws Exception
988
     */
989
    public function suspend($user, $reason, $disallowUnsuspension = true)
990
    {
991
        $params = ['user' => $user, 'reason' => $reason, 'disallowun' => (int) $disallowUnsuspension];
992
        $result = $this->client->sendRequest("/json-api/suspendacct", "GET", $params);
993
994
        if(!empty($result['metadata']) && $result['metadata']['result'] === 0){
995
            throw new ClientExceptions($result['metadata']['reason']);
996
        }
997
998
        if(!empty($result['metadata']) && $result['metadata']['result'] === 1){
999
            return true;
1000
        }
1001
1002
        return false;
1003
    }
1004
}
1005