private static function filterConstantsByLevel($constants, $level)
    {
        foreach ($constants as $constantName => $value) {
            if (!self::inBitmask($value, $level)) {
                unset($constants[$constantName]);
            }
        }
        unset($constants['E_ALL']);
        return $constants;
    }