trompette/php-feature-toggles

Console command configure-feature does not validate input

Opened this issue · 1 comments

This call combined to this console command makes it possible to call any public method of a TogglingStrategy, including those that are not relevant to the command, for example:

console feature-toggles:configure-feature my_feature onoff getConfiguration

Not sure if this is an issue, but I guess it was not intended.

Also, the parameters are not validated, and such the following call (with a parameter missing) will throw an exception:

console feature-toggles:configure-feature my_feature percentage slide

I understand that this console command is here to provide some basic support, but maybe there should be a separate, dedicated command for each strategy, with each command featuring proper validation? Something like:

console feature-toggles:configure-feature:on-off my_feature on

console feature-toggles:configure-feature:percentage my_feature 10

console feature-toggles:configure-feature:whitelist my_feature my_target

What do you think?

What do you think?

I intended the ConfigureFeatureCommand to be the single CLI entrypoint to configure any feature, because I wanted adding new strategies to be as easy as possible.

But, since the class is generic, implementing strategy-specific behaviours like parameter validation is more complex.

I think what you are proposing is a good idea and would not make adding new strategies that more difficult.