public function validateRights($permissions, $bitmask = 0)
    {
        $valid = 0;
        if (is_array($bitmask)) {
            foreach ($bitmask as $bit) {
                $valid = $this->validateRights($permissions, $bit);
            }
        } else {
            $valid = $permissions & $bitmask;
        }

        return $valid;
    }
public function validateRights($permissions, $bitmask = 0)
    {
        $valid = 0;
        if (is_array($bitmask)) {
            foreach ($bitmask as $bit) {
                $valid = $this->validateRights($permissions, $bit);
            }
        } else {
            $valid = $permissions & $bitmask;
        }

        return $valid;
    }
public function validateRights ( $ permissions , $ bitmask = 0 ) { $ valid = 0 ; if ( is_array ( $ bitmask ) ) { foreach ( $ bitmask as $ bit ) { $ valid = $ this -> validateRights ( $ permissions , $ bit ) ; } } else { $ valid = $ permissions & $ bitmask ; } return $ valid ; }
Used to validate rights.

@param $permissions
@param int|array $bitmask

@return int
Used to validate rights .