<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Made of Everything You&#039;re Not &#187; phploc</title>
	<atom:link href="http://blog.ericlamb.net/tag/phploc/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ericlamb.net</link>
	<description>Thoughts on programming, people and life</description>
	<lastBuildDate>Wed, 11 Aug 2010 03:58:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Simple Project Profiling With PHPLoc</title>
		<link>http://blog.ericlamb.net/2009/11/simple-project-profiling-with-phploc/</link>
		<comments>http://blog.ericlamb.net/2009/11/simple-project-profiling-with-phploc/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 12:21:54 +0000</pubDate>
		<dc:creator>Eric Lamb</dc:creator>
				<category><![CDATA[Brain Dump]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phploc]]></category>

		<guid isPermaLink="false">http://blog.ericlamb.net/?p=772</guid>
		<description><![CDATA[One of the most natural things to do while being an obsessive programmer is focusing on the minutia. Not only do our projects have to perform and function to our standards but they also have to be structured &#8220;just so&#8221; with just the right comment style and just the right indentation to space ratio (4 [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most natural things to do while being an obsessive programmer is focusing on the minutia. Not only do our projects have to perform and function to our standards but they also have to be structured &#8220;just so&#8221; with just the right comment style and just the right indentation to space ratio (4 of course!). Point being that, for me, it&#8217;s ridiculously easy to spend time and energy focusing on, what amounts to in the end, as trivial. I was reminded of this while playing around with the latest release of <a title="PHPLoc" href="http://github.com/sebastianbergmann/phploc" onclick="return TrackClick('http%3A%2F%2Fgithub.com%2Fsebastianbergmann%2Fphploc','PHPLoc')" target="_blank">PHPLoc</a> (1.40).</p>
<div id="attachment_2674" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.flickr.com/photos/grahambones/2168343862/sizes/l/" onclick="return TrackClick('http%3A%2F%2Fwww.flickr.com%2Fphotos%2Fgrahambones%2F2168343862%2Fsizes%2Fl%2F','Photo%3A+Grahambones')"><img class="size-medium wp-image-2674" title="Photo: Grahambones" src="http://blog.ericlamb.net/wp-content/uploads/2009/11/waste-of-time-300x200.jpg" alt="Photo: Grahambones" width="300" height="200" /></a><p class="wp-caption-text">Photo: Grahambones</p></div>
<p>PHPLoc is a project by <a title="Sebastian Bergman" href="http://sebastian-bergmann.de/" onclick="return TrackClick('http%3A%2F%2Fsebastian-bergmann.de%2F','Sebastian+Bergman')" target="_blank">Sebastian Berman</a> that measures the size of a PHP project. In a nutshell PHPLoc is a project analyzer that shows details like amount of classes, files, directories and total <strong>L</strong>ines <strong>O</strong>f <strong>C</strong>ode (PHPLoc get it?) to name a few features. It&#8217;s ran from the command line and I had no issue getting it to work on Windows (huge plus for quality IMHO). </p>
<p>According to the Git repository:</p>
<blockquote>
<p><strong>phploc</strong> is a tool for quickly measuring the size of a PHP project.</p>
<p>The goal of <strong>phploc</strong> is not not to replace more sophisticated tools such as <a href="http://pear.php.net/PHP_CodeSniffer" onclick="return TrackClick('http%3A%2F%2Fpear.php.net%2FPHP_CodeSniffer','phpcs')" target="_blank">phpcs</a>, <a href="http://pdepend.org/" onclick="return TrackClick('http%3A%2F%2Fpdepend.org%2F','pdepend')" target="_blank">pdepend</a>, or <a href="http://phpmd.org/" onclick="return TrackClick('http%3A%2F%2Fphpmd.org%2F','phpmd')" target="_blank">phpmd</a>, but rather to provide an alternative to them when you just need to get a quick understanding of a project&#8217;s size.</p>
</blockquote>
<p>PHPLoc works as a PEAR module (requires PEAR installer version 1.8.1 at least) and as such is really easy to install. There&#8217;s some great instructions on the Git site that I had zero issues with (outside of having to update PEAR) so I won&#8217;t go into detail here.</p>
<p>Here&#8217;s an example of the output when ran against a Zend Framework 1.9 distribution:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">C:\php<span style="color: #000000; font-weight: bold;">&gt;</span>phploc <span style="color: #660033;">--count-tests</span> C:\ProjectFiles\ZF
phploc 1.4.0 by Sebastian Bergmann.
&nbsp;
Directories:                                        <span style="color: #000000;">393</span>
Files:                                             <span style="color: #000000;">1856</span>
&nbsp;
Lines of Code <span style="color: #000;">&#40;</span>LOC<span style="color: #000;">&#41;</span>:                             <span style="color: #000000;">372292</span>
  Cyclomatic Complexity <span style="color: #000000; font-weight: bold;">/</span> Lines of Code:           <span style="color: #000000;">0.11</span>
Comment Lines of Code <span style="color: #000;">&#40;</span>CLOC<span style="color: #000;">&#41;</span>:                    <span style="color: #000000;">173793</span>
Non-Comment Lines of Code <span style="color: #000;">&#40;</span>NCLOC<span style="color: #000;">&#41;</span>:               <span style="color: #000000;">198499</span>
&nbsp;
Namespaces:                                           <span style="color: #000000;">0</span>
Interfaces:                                          <span style="color: #000000;">94</span>
Classes:                                           <span style="color: #000000;">1758</span>
  Abstract:                                         <span style="color: #000000;">155</span> <span style="color: #000;">&#40;</span><span style="color: #000000;">8.82</span><span style="color: #000000; font-weight: bold;">%</span><span style="color: #000;">&#41;</span>
  Concrete:                                        <span style="color: #000000;">1603</span> <span style="color: #000;">&#40;</span><span style="color: #000000;">91.18</span><span style="color: #000000; font-weight: bold;">%</span><span style="color: #000;">&#41;</span>
  Lines of Code <span style="color: #000000; font-weight: bold;">/</span> Number of Classes:                <span style="color: #000000;">167</span>
Methods:                                          <span style="color: #000000;">12377</span>
  Scope:
    Non-Static:                                   <span style="color: #000000;">11517</span> <span style="color: #000;">&#40;</span><span style="color: #000000;">93.05</span><span style="color: #000000; font-weight: bold;">%</span><span style="color: #000;">&#41;</span>
    Static:                                         <span style="color: #000000;">860</span> <span style="color: #000;">&#40;</span><span style="color: #000000;">6.95</span><span style="color: #000000; font-weight: bold;">%</span><span style="color: #000;">&#41;</span>
  Visibility:
    Public:                                        <span style="color: #000000;">9886</span> <span style="color: #000;">&#40;</span><span style="color: #000000;">79.87</span><span style="color: #000000; font-weight: bold;">%</span><span style="color: #000;">&#41;</span>
    Non-Public:                                    <span style="color: #000000;">2491</span> <span style="color: #000;">&#40;</span><span style="color: #000000;">20.13</span><span style="color: #000000; font-weight: bold;">%</span><span style="color: #000;">&#41;</span>
  Lines of Code <span style="color: #000000; font-weight: bold;">/</span> Number of Methods:                 <span style="color: #000000;">23</span>
  Cyclomatic Complexity <span style="color: #000000; font-weight: bold;">/</span> Number of Methods:       <span style="color: #000000;">2.78</span>
&nbsp;
Anonymous Functions:                                  <span style="color: #000000;">0</span>
Functions:                                            <span style="color: #000000;">0</span>
&nbsp;
Constants:                                         <span style="color: #000000;">3361</span>
  Global constants:                                   <span style="color: #000000;">1</span>
  Class constants:                                 <span style="color: #000000;">3360</span>
&nbsp;
Tests:
  Classes:                                            <span style="color: #000000;">2</span>
  Methods:                                            <span style="color: #000000;">0</span></pre></div></div>

<p>As you can see, PHPLoc gives some really nice insight into a project. I have to admit I&#8217;m more interested in the OCD satisfaction than the practical reasons but it&#8217;s still cool. Definitely check it out if you&#8217;re looking to get some interesting though completely trivial information about your project. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ericlamb.net/2009/11/simple-project-profiling-with-phploc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
