Drupal using static functions or a service

Submitted bybarnettech onThu, 06/03/2021 - 14:51


If there are not dependencies and it's not a pain to mock in a unit test, or for re-use then static is fine. A service lets you encapsulate everything and all the dependencies using dependency injection, to make sure all the dependencies are easy to setup.