How to represent in bistmasks the type of bounce of AWS SES

34 views Asked by At

I'm writing a Symfony's Bundle to manage AWS SNS notifications sent by AWS SES.

I'm representing a Bounce object and for the moment I'm using constants:

/**
 * A Bounce Entity.
 *
 * @see http://docs.aws.amazon.com/ses/latest/DeveloperGuide/notification-contents.html#bounce-object
 */
class Bounce
{
    const TYPE_PERMANENT            = 'Permanent';
    const TYPE_PERM_GENERAL         = 'General';
    const TYPE_PERM_NOEMAIL         = 'NoEmail';
    const TYPE_PERM_SUPPRESSED      = 'Suppressed';

    const TYPE_TRANSIENT            = 'Transient';
    const TYPE_TRANS_GENERAL        = 'General';
    const TYPE_TRANS_BOXFULL        = 'MailboxFull';
    const TYPE_TRANS_TOOLARGE       = 'MessageTooLarge';
    const TYPE_TRANS_CONTREJECTED   = 'ContentRejected';
    const TYPE_TRANS_ATTACHREJECTED = 'AttachmentRejected';

    const TYPE_UNDETERMINED         = 'Undetermined';
    ...

Now, as those value will be written to the database, using strings increases a lot the space I've to use to save the notifications so I took at bitmasks but I've never used them

I've read something about bitmasks here on StackOverflow but I cannot apply to this concrete scenario what I read.

How can I use bitmasks to represent these constants? Is there a way, using bitmasks, to also "validate" the type and sub type of notification?

0

There are 0 answers