Is it considered a bad design if a function uses the value of a parameter only if another parameter has a certain value?
Here’s an example function:
validate_input($field_name, $validation_rule, $validation_value);
Here’s the function in use:
validate_input("username", "required");
validate_input("username", "min_length", 3);
In the first usage example the third parameter is omitted. The second parameter has a value of “required” and that makes the third parameter irrelevant. If a third parameter is passed the function will not take it into consideration.
Does that make the design of the function bad?
I’d say no, absolutely not.
If you document your code, mark the third parameter as optional.
In phpDocumentor, this is achieved by giving it a default value (which you need to do anyway in your case).
I have never come across an opinion that speaks out against this.