{"id":166,"date":"2025-12-18T17:21:46","date_gmt":"2025-12-18T22:21:46","guid":{"rendered":"https:\/\/kimsal.com\/blog\/?p=166"},"modified":"2025-12-15T17:34:48","modified_gmt":"2025-12-15T22:34:48","slug":"php-quality-tools-phploc-lines-of-code","status":"publish","type":"post","link":"https:\/\/kimsal.com\/blog\/2025\/12\/18\/php-quality-tools-phploc-lines-of-code\/","title":{"rendered":"PHP Quality Tools &#8211; phploc lines of code"},"content":{"rendered":"\n<p>Need to check the lines of code in a PHP codebase?  The phploc tool has you covered.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ phpqa phploc .\/app<\/code><\/pre>\n\n\n\n<p>This will give a summary of lines of code, separating out comments and non-comments, then gives you a whole lot more.<\/p>\n\n\n\n<p>The cyclocmatic complexity measure is possible one of the more useful tools.  Understanding that you have classes and methods that might be &#8216;too complex&#8217; is the first step in dealing with that.  <\/p>\n\n\n\n<p>Why should you care about complexity?  Less complex code provides<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ease of long-term maintenance <\/li>\n\n\n\n<li>Ability for new folks to understand the code more quickly<\/li>\n\n\n\n<li>Smaller focused methods to test<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"477\" height=\"1024\" src=\"https:\/\/kimsal.com\/blog\/wp-content\/uploads\/2025\/12\/phpqa-phploc-1-477x1024.png\" alt=\"\" class=\"wp-image-167\" srcset=\"https:\/\/kimsal.com\/blog\/wp-content\/uploads\/2025\/12\/phpqa-phploc-1-477x1024.png 477w, https:\/\/kimsal.com\/blog\/wp-content\/uploads\/2025\/12\/phpqa-phploc-1-140x300.png 140w, https:\/\/kimsal.com\/blog\/wp-content\/uploads\/2025\/12\/phpqa-phploc-1-768x1649.png 768w, https:\/\/kimsal.com\/blog\/wp-content\/uploads\/2025\/12\/phpqa-phploc-1-716x1536.png 716w, https:\/\/kimsal.com\/blog\/wp-content\/uploads\/2025\/12\/phpqa-phploc-1-954x2048.png 954w, https:\/\/kimsal.com\/blog\/wp-content\/uploads\/2025\/12\/phpqa-phploc-1-scaled.png 1193w\" sizes=\"auto, (max-width: 477px) 100vw, 477px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Need to check the lines of code in a PHP codebase? The phploc tool has you covered. 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&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-166","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/kimsal.com\/blog\/wp-json\/wp\/v2\/posts\/166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kimsal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kimsal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kimsal.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kimsal.com\/blog\/wp-json\/wp\/v2\/comments?post=166"}],"version-history":[{"count":1,"href":"https:\/\/kimsal.com\/blog\/wp-json\/wp\/v2\/posts\/166\/revisions"}],"predecessor-version":[{"id":168,"href":"https:\/\/kimsal.com\/blog\/wp-json\/wp\/v2\/posts\/166\/revisions\/168"}],"wp:attachment":[{"href":"https:\/\/kimsal.com\/blog\/wp-json\/wp\/v2\/media?parent=166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kimsal.com\/blog\/wp-json\/wp\/v2\/categories?post=166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kimsal.com\/blog\/wp-json\/wp\/v2\/tags?post=166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}