2013-05-03 17:02:53 +02:00
|
|
|
<?php
|
2013-05-16 03:16:56 +02:00
|
|
|
/**
|
|
|
|
* PHPCI - Continuous Integration for PHP
|
|
|
|
*
|
|
|
|
* @copyright Copyright 2013, Block 8 Limited.
|
|
|
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
|
|
|
* @link http://www.phptesting.org/
|
|
|
|
*/
|
2013-05-03 17:02:53 +02:00
|
|
|
|
|
|
|
namespace PHPCI\Plugin;
|
|
|
|
|
2013-05-16 03:30:48 +02:00
|
|
|
/**
|
|
|
|
* PHP Mess Detector Plugin - Allows PHP Mess Detector testing.
|
|
|
|
* @author Dan Cryer <dan@block8.co.uk>
|
|
|
|
* @package PHPCI
|
|
|
|
* @subpackage Plugins
|
|
|
|
*/
|
2013-05-03 17:02:53 +02:00
|
|
|
class PhpMessDetector implements \PHPCI\Plugin
|
|
|
|
{
|
|
|
|
protected $directory;
|
|
|
|
|
|
|
|
public function __construct(\PHPCI\Builder $phpci, array $options = array())
|
|
|
|
{
|
|
|
|
$this->phpci = $phpci;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function execute()
|
|
|
|
{
|
2013-05-16 01:17:57 +02:00
|
|
|
$ignore = '';
|
|
|
|
|
2013-05-03 17:02:53 +02:00
|
|
|
if(count($this->phpci->ignore))
|
|
|
|
{
|
|
|
|
$ignore = array_map(function($item)
|
|
|
|
{
|
|
|
|
return substr($item, -1) == '/' ? $item . '*' : $item . '/*';
|
|
|
|
}, $this->phpci->ignore);
|
|
|
|
|
|
|
|
$ignore = ' --exclude ' . implode(',', $ignore);
|
|
|
|
}
|
|
|
|
|
2013-05-16 01:17:57 +02:00
|
|
|
return $this->phpci->executeCommand(PHPCI_BIN_DIR . 'phpmd "%s" text codesize,unusedcode,naming %s', $this->phpci->buildPath, $ignore);
|
2013-05-03 17:02:53 +02:00
|
|
|
}
|
|
|
|
}
|