3 ms·
I've written this exact idiom in some parts of a very poorly structured, tightly-coupled PHP codebase I've inherited. I'm not a huge fan, because it clutters th
by bartonfink 12y ago
I've written this exact idiom in some parts of a very poorly structured, tightly-coupled PHP codebase I've inherited. I'm not a huge fan, because it clutters the codebase a bit (that's 4 lines of overhead per dependency), but in the absence of a true DI framework this is better than nothing. You get many of the functional benefits of DI, but not all of the niceties when it comes to cleaning up your code.