1

I've got two functions at the moment:

suspendGroupsAndUsers($groupId){}
enableGroupsAndUsers($groupId) {}

But the difference between the two is one variable/string. Should I just have:

setStatusGroupsAndUsers($status,$groupID) {}

This feels more DRY... Or have the above two functions actually call the setStatus function?

Gut says use setStatus ...

user127379
  • 361
  • 2
  • 8
  • Related, if not an exact duplicate: http://programmers.stackexchange.com/questions/147977/is-it-wrong-to-use-a-boolean-parameter-to-determine-behavior – pdr Jan 14 '14 at 14:11

1 Answers1

1

If your status can eventually become something else than a boolean value (enabled, suspended, hidden, banned, etc.), you may have to refactor if you only use setStatus.