Result Aggregation

PHP_CodeBrowser is a report generator that takes the XML logfiles generated by PHP_CodeSniffer, PHP Copy/Paste Detector, PHPMD, and PHPUnit as well as the sourcecode of the project as its input. The aggregated result of this is a browsable snapshot of the source code annotated with the violations found by these tools.

Example 4-9 shows how to invoke PHP_CodeBrowser from our Apache Ant build script.

Example 4-9. The phpcb build target for PHP_CodeBrowser

<target name="phpcb"
        description="Aggregate tool output with PHP_CodeBrowser">
 <exec executable="phpcb">
  <arg value="--log" />
  <arg path="${basedir}/build/logs" />
  <arg value="--source" />
  <arg path="${basedir}/src" />
  <arg value="--output" />
  <arg path="${basedir}/build/code-browser" />
 </exec>
</target>

Figure 4-10 shows how to configure a post-build action in our Jenkins job to publish the HTML reports generated by PHP_CodeBrowser and PHPDocumentor.