Monthly Archives: March 2010

Appearances can be deceptive

A couple of days ago I rented “Burn After Reading” movie. I have no idea how it ended up on my rental list, but I can tell you now, this is the most wicked, crazy film I have ever seen! When it finished, the only words that came out of my mouth were: WTF?! So I watched it again, and I couldn’t  resist, but to make some notes. So here they are:

A lawyer speaking to Ozzie’s wife:

Do this before the turtle can draw in his head and his feet.

Harry’s (George Clooney) best moments:

- "I should try to get a run in."
- "20 years of service, never discharged it."

Harry, after catching a law firm detective:

- "Who do you work for? CIA NSA."
- "Tuchman Marsh"
- "Is that a law firm?"
- "No, a rock band!"

Chad (Brad Pitt) after finding the CD:

"This is some heavy shit. This is some intelligence shit. And signals and shit… and dates and number… and dates… and numbers… and shit! I think that's the shit man! Signals intelligence shit."

Chad calling Ozzie:

- "I am a Good Samaritan, a traveller on the road."
- "You may be worried about the security of your shit."

Linda Litzke speaking with the Russians:

- "The fish has bitten!"
- "Mr. Krapotkin, is this a secure line?"

And finally the best scene ever!

If you haven’t seen it yet, this is a must see. If you have… well it’s time to watch it again!

Integrate PHP_Depend with phpUnderControl

The newest version of phpUnderControl has now basic support for PHP_Depend. With PHPUnit deprecating support for metrics, it’s just about the time to switch. And it’s not as complicated as it might sound.

First of all you need to install PHP_Depend. Using pear it’s the easiest and quickest way to do it. If you haven’t registered PHP_Depend pear channel yet, it is time to do it now:

141:~ sebmarek$ sudo pear channel-discover
Adding Channel "" succeeded
Discovery of channel "" succeeded

After that simply use pear to install the latest version of PHP_Depend:

141:~ sebmarek$ sudo pear install pdepend/PHP_Depend-beta
Did not download optional dependencies: pecl/imagick, use --alldeps to download automatically
pdepend/PHP_Depend can optionally use package "pecl/imagick" (version >= 2.2.0b2)
downloading PHP_Depend-0.9.11.tgz ...
Starting to download PHP_Depend-0.9.11.tgz (323,787 bytes)
..................................................................done: 323,787 bytes
install ok: channel://

and confirm that PHP_Depend installed successfully:

141:~ sebmarek$ pdepend --version
PHP_Depend 0.9.11 by Manuel Pichler

The next step is to modify your project’s build file. If you don’t use phpunit configuration xml file the change is really simple. Just remove –log-metrics option from your phpunit ant task:

<target name="phpunit">
    <exec dir="/pth/to/your/module" executable="phpunit" failonerror="true">
        <arg line="--log-junit ${basedir}/build/logs/phpunit.xml
                   --log-metrics ${basedir}/build/logs/phpunit.metrics.xml
                   --coverage-xml ${basedir}/build/logs/phpunit.coverage.xml
                   --coverage-html ${basedir}/build/coverage" />

If you use phpunit xml file remove relevant entry from logging section:

    <log type="coverage-html" target="/path/to/build/coverage/" charset="UTF-8" yui="true" highlight="false" lowUpperBound="35" highLowerBound="70"/>
    <log type="coverage-clover" target="/path/to/build/logs/phpunit.coverage.xml"/>
    <log type="junit" target="/path/to/build/logs/phpunit.test.xml" logIncompleteSkipped="true"/>
    <log type="metrics-xml" target="/path/to/build/logs/metrics.xml"/>

Finally just add new ant task in the build file that will run pdepend and generate metrics xml file and additional graphs.

<target name="php-depend">
    <exec executable="pdepend" dir="${basedir}/Source" logerror="on">
        <arg line="--phpunit-xml=${basedir}/build/logs/pdepend.xml
                   . " />

<target name="phpunit">
    <exec dir="${basedir}/Source/Test/" executable="phpunit" failonerror="true" />

<target name="build" depends="clean,checkout-code,php-documentor,php-codesniffer,php-depend,phpunit" />

Now either wait until next build happens or simply trigger the next build manually and navigate to the metrics tab. All the charts should be still there. In addition two additional charts has been added – Package Dependencies and visual summary of the analyzed project source code.

PHP_Depend metrics

Additional charts generated with PHP_Depend

Package dependencies chart is also shown at the top of phpUnderControl Overview tab.

To learn more about software metric and PHP_Depend itself have a look at Documentation section at