Code Duplication    Length = 12-14 lines in 2 locations

src/database/Postgres.php 2 locations

@@ 7850-7861 (lines=12) @@
7847
     * @param int $admin    (optional) Flag to grant the admin option
7848
     * @return \PHPPgAdmin\Database\A 0 success
7849
     */
7850
    public function grantRole($role, $rolename, $admin = 0)
7851
    {
7852
        $this->fieldClean($role);
7853
        $this->fieldClean($rolename);
7854
7855
        $sql = "GRANT \"{$role}\" TO \"{$rolename}\"";
7856
        if ($admin == 1) {
7857
            $sql .= ' WITH ADMIN OPTION';
7858
        }
7859
7860
        return $this->execute($sql);
7861
    }
7862
7863
    /**
7864
     * Revokes membership in a role
@@ 7872-7885 (lines=14) @@
7869
     * @param string $type     (optional) Type of revoke: RESTRICT | CASCADE
7870
     * @return \PHPPgAdmin\Database\A 0 success
7871
     */
7872
    public function revokeRole($role, $rolename, $admin = 0, $type = 'RESTRICT')
7873
    {
7874
        $this->fieldClean($role);
7875
        $this->fieldClean($rolename);
7876
7877
        $sql = 'REVOKE ';
7878
        if ($admin == 1) {
7879
            $sql .= 'ADMIN OPTION FOR ';
7880
        }
7881
7882
        $sql .= "\"{$role}\" FROM \"{$rolename}\" {$type}";
7883
7884
        return $this->execute($sql);
7885
    }
7886
7887
    /**
7888
     * Removes a role