3

pdepend is a useful tool for doing static analysis on a php codebase, but it doesn't know how to interpret Mage::(getBlock|getModel|helper|…) factory methods to their actual classnames. Factories may exist precisely to help relax tight coupling, but for pdepend purposes I want it to report on the resolved classnames. For example, if I have

$foo = Mage::getModel('eb2caddress/validator')->isValid($address);

I would like pdepend to see something like:

$v = new EbayEnterprise_Eb2cAddress_Model_Validator();
$foo = $v->isValid($address);

I started hacking together a shell script that would automatically do the above conversion, but as I am working on it I'm beginning to realize that I'm going to have a hard time with constructor arguments and singletons. Furthermore, the shell may not be the right approach. Are there any better tools to solve this problem? Even if the end result doesn't use pdepend, any Magento-aware tool (or a tool that can be configured to understand an arbitrary factory) that can tell me various modules' afferent and efferent coupling and relative responsibility as well as a straightforward depgraph would be really helpful.

Is anyone aware of such a tool, or how to get pdepend to understand Magento factories?

4
  • Did you ever try asking them on github? github.com/pdepend/pdepend/issues Jul 25, 2014 at 13:05
  • 4
    This question appears to be off-topic because it is about a third party module support. Contact the developer.
    – Marius
    Sep 11, 2014 at 6:02
  • 3
    This question is very relevant in regards to Magento Extension code quality. Unfortunately I don't have an answer, but I don't think it is off topic at all.
    – Vinai
    Oct 16, 2014 at 16:22
  • @Vinai I think you can vote to have it reopened.
    – kojiro
    Oct 16, 2014 at 18:14

0

Browse other questions tagged or ask your own question.