phpci/PHPCI/Plugin/PhpCpd.php

40 lines
1 KiB
PHP
Raw Normal View History

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;
class PhpCpd implements \PHPCI\Plugin
{
protected $directory;
protected $args;
protected $phpci;
public function __construct(\PHPCI\Builder $phpci, array $options = array())
{
$this->phpci = $phpci;
$this->directory = isset($options['directory']) ? $options['directory'] : $phpci->buildPath;
$this->standard = isset($options['standard']) ? $options['standard'] : 'PSR2';
}
public function execute()
{
$ignore = '';
2013-05-03 17:02:53 +02:00
if(count($this->phpci->ignore))
{
$ignore = array_map(function($item)
{
return ' --exclude ' . (substr($item, -1) == '/' ? substr($item, 0, -1) : $item);
2013-05-03 17:02:53 +02:00
}, $this->phpci->ignore);
$ignore = implode('', $ignore);
2013-05-03 17:02:53 +02:00
}
return $this->phpci->executeCommand(PHPCI_BIN_DIR . 'phpcpd %s "%s"', $ignore, $this->phpci->buildPath);
2013-05-03 17:02:53 +02:00
}
}