Skip to content

Make it stateless #2

@ircmaxell

Description

@ircmaxell

I strongly recommend that you make the class stateless rather than statefull as you have it now.

Basically, don't pass in input to the constructor, but instead have discrete encrypt($text) and decrypt($text) methods.

This will make it far easier to reason about what's going on, because object state doesn't need to be considered. And separating encryption flows from decryption flows will also provide clarity.

And as a stateless object, it can be re-used (which means things like setup can be shared across encryption/decryption runs).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions