PHP Quality Tools – phploc lines of code

Need to check the lines of code in a PHP codebase? The phploc tool has you covered.

$ phpqa phploc ./app

This will give a summary of lines of code, separating out comments and non-comments, then gives you a whole lot more.

The cyclocmatic complexity measure is possible one of the more useful tools. Understanding that you have classes and methods that might be ‘too complex’ is the first step in dealing with that.

Why should you care about complexity? Less complex code provides

  • Ease of long-term maintenance
  • Ability for new folks to understand the code more quickly
  • Smaller focused methods to test

Similar Posts

  • Onboarding freelancers

    Maari Casey over at uncompany had a recent LinkedIn post about planning for freelancers. She made some good points, but I think skipped one, and it’s not just relevant for freelancers. Even well before an organization might need extra work – be it freelance or employee – companies need to have a plan for onboarding….

  • Laravel down migrations

    I get an email newsletter from Martin Joo every week or so. The newsletters generally have some useful tips around the Laravel framework or sometimes just general development tips. I’ve learned a couple of neat tricks here and there, and will continue to receive. This morning I received an email with a Laravel ‘tip’ regarding…

  • Four Thousand Weeks

    I’m starting to read “Four Thousand Weeks” from Oliver Burkeman. I initially listened to much of the audio book, then bought a copy (link above to Amazon – no affiliate link). Have not finished yet, but the core message of the book seems to be There’s certainly more to it than this, and again, I’m…

  • Bad I9 PDF form

    Have been needing to programmatically fill out an I9 PDF, retrieved from gov site. Should be fairly straightforward, right? Well… the field names are… a mess. Field names like topmostSubform[0].Page1[0].U\.S\._Social_Security_Number__Last_4_numbers_[0]topmostSubform[0].Page1[0].expiration_date__if_applicable__mm_dd_yyyy[0] topmostSubform[0].Page2[0].Employers_Business_or_Organization_Address_Street_Number_and_Name[0] and so on make it pretty… not straightforward to create a usable key/value combination to search and replace. But… today, I noticed it got…

Leave a Reply

Your email address will not be published. Required fields are marked *