Created
April 13, 2012 16:50
-
-
Save manuelpichler/2378294 to your computer and use it in GitHub Desktop.
Custom PHPMD rule
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class My_Custom_Symfony2Rule extends PHP_PMD_Rule implements PHP_PMD_Rule_IClassAware | |
{ | |
public function apply($class) | |
{ | |
// Skip here | |
if (false === $this->isController($class)) { | |
return; | |
} | |
// Do some controller specific analysis | |
} | |
protected function isController($class) | |
{ | |
foreach ($class->getInterfaces() as $interface) | |
{ | |
if ($interface->getName() === 'ControllerInterface) { | |
return true; | |
} | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment