public static function calculateBitmask(array $options)
    {
        $bitmask = 0;

        foreach ($options as $optionName) {
            if (\defined($optionName)) {
                $bitmask |= \constant($optionName);
            }
        }

        return $bitmask;
    }