protected function validateOverwritePermissions($memberOrRole, $allow, $deny = 0) {
        $options = array();
        
        if($memberOrRole instanceof \CharlotteDunois\Yasmin\Models\GuildMember) {
            $memberOrRole = $memberOrRole->id;
            $options['type'] = 'member';
        } elseif($memberOrRole instanceof \CharlotteDunois\Yasmin\Models\Role) {
            $memberOrRole = $memberOrRole->id;
            $options['type'] = 'role';
        } else {
            try {
                $memberOrRole = $this->guild->roles->resolve($memberOrRole)->id;
                $options['type'] = 'role';
            } catch (\InvalidArgumentException $e) {
                $options['type'] = 'member';
            }
        }
        
        if(!\is_int($allow) && !($allow instanceof \CharlotteDunois\Yasmin\Models\Permissions)) {
            throw new \InvalidArgumentException('Allow has to be an int or an instance of Permissions');
        }
        
        if(!\is_int($deny) && !($deny instanceof \CharlotteDunois\Yasmin\Models\Permissions)) {
            throw new \InvalidArgumentException('Deny has to be an int or an instance of Permissions');
        }
        
        if(\json_encode($allow) === \json_encode($deny)) {
            throw new \InvalidArgumentException('Allow and deny must have different permissions');
        }
        
        $options['allow'] = $allow;
        $options['deny'] = $deny;
        
        return array($memberOrRole, $options);
    }
protected function validateOverwritePermissions($memberOrRole, $allow, $deny = 0) {
        $options = array();
        
        if($memberOrRole instanceof \CharlotteDunois\Yasmin\Models\GuildMember) {
            $memberOrRole = $memberOrRole->id;
            $options['type'] = 'member';
        } elseif($memberOrRole instanceof \CharlotteDunois\Yasmin\Models\Role) {
            $memberOrRole = $memberOrRole->id;
            $options['type'] = 'role';
        } else {
            try {
                $memberOrRole = $this->guild->roles->resolve($memberOrRole)->id;
                $options['type'] = 'role';
            } catch (\InvalidArgumentException $e) {
                $options['type'] = 'member';
            }
        }
        
        if(!\is_int($allow) && !($allow instanceof \CharlotteDunois\Yasmin\Models\Permissions)) {
            throw new \InvalidArgumentException('Allow has to be an int or an instance of Permissions');
        }
        
        if(!\is_int($deny) && !($deny instanceof \CharlotteDunois\Yasmin\Models\Permissions)) {
            throw new \InvalidArgumentException('Deny has to be an int or an instance of Permissions');
        }
        
        if(\json_encode($allow) === \json_encode($deny)) {
            throw new \InvalidArgumentException('Allow and deny must have different permissions');
        }
        
        $options['allow'] = $allow;
        $options['deny'] = $deny;
        
        return array($memberOrRole, $options);
    }
protected function validateOverwritePermissions ( $ memberOrRole , $ allow , $ deny = 0 ) { $ options = array ( ) ; if ( $ memberOrRole instanceof \ CharlotteDunois \ Yasmin \ Models \ GuildMember ) { $ memberOrRole = $ memberOrRole -> id ; $ options [ 'type' ] = 'member' ; } elseif ( $ memberOrRole instanceof \ CharlotteDunois \ Yasmin \ Models \ Role ) { $ memberOrRole = $ memberOrRole -> id ; $ options [ 'type' ] = 'role' ; } else { try { $ memberOrRole = $ this -> guild -> roles -> resolve ( $ memberOrRole ) -> id ; $ options [ 'type' ] = 'role' ; } catch ( \ InvalidArgumentException $ e ) { $ options [ 'type' ] = 'member' ; } } if ( ! \ is_int ( $ allow ) && ! ( $ allow instanceof \ CharlotteDunois \ Yasmin \ Models \ Permissions ) ) { throw new \ InvalidArgumentException ( 'Allow has to be an int or an instance of Permissions' ) ; } if ( ! \ is_int ( $ deny ) && ! ( $ deny instanceof \ CharlotteDunois \ Yasmin \ Models \ Permissions ) ) { throw new \ InvalidArgumentException ( 'Deny has to be an int or an instance of Permissions' ) ; } if ( \ json_encode ( $ allow ) === \ json_encode ( $ deny ) ) { throw new \ InvalidArgumentException ( 'Allow and deny must have different permissions' ) ; } $ options [ 'allow' ] = $ allow ; $ options [ 'deny' ] = $ deny ; return array ( $ memberOrRole , $ options ) ; }
Validates the given overwritePermissions arguments.
@param \CharlotteDunois\Yasmin\Models\GuildMember|\CharlotteDunois\Yasmin\Models\Role|string  $memberOrRole  The member or role.
@param \CharlotteDunois\Yasmin\Models\Permissions|int                                         $allow         Which permissions should be allowed?
@param \CharlotteDunois\Yasmin\Models\Permissions|int                                         $deny          Which permissions should be denied?
@return array
@throws \InvalidArgumentException
Validates the given overwritePermissions arguments .