View Source

<ac:macro ac:name="note"><ac:parameter ac:name="title">Under Construction</ac:parameter><ac:rich-text-body>
<p>This proposal is under construction and is not ready for review.</p></ac:rich-text-body></ac:macro>

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}





Zend_Pmd is Zend Framework coding standards checker. This component helps your developer team keep the same coding standards.

* [PMD for Java programmers|]


* Zend_Exception
* Zend_Loader



* Zend_Pmd
* Zend_Pmd_Result
* Zend_Pmd_Exception
* Zend_Pmd_Plugins_Interface
* Zend_Pmd_Plugins_StartTag
* Zend_Pmd_Plugins_EndTag


$pmd = new Zend_Pmd('file.php');

//Process PMD

//Is there any warnings or errors?
if (!$num_errors = count($pmd)) {
echo 'Your PHP file is without warnings or errors!';
} else {
echo 'You have <strong>' . $num_errors . '</strong> errors and warnings' ;

//If you want show errors or warnings, you can do it by 2 ways:

//1. Echo results by calling __toSring() method:
//set line separator
$pmd->setLineSeparator('<br />\n');
echo $pmd;
//The output is for example:
// Line: 1, error: PHP file must start with <?php<br />\n
// Line: 18, error: dont't use else if, use elseif insted<br />\n
// Line: 332, error: PHP file cannot be ended with ?><br />\n

//2. Retrive results by foreach loop (don't call Zend_Pmd::process() first!)
foreach ($pmd as $value) {
echo 'Line: ' . $value->getLine() . ', message: ' . $value->getMessage() . '<br />\n';