Merge branch 'feature-phpci-sync'

This commit is contained in:
Dmitry Khomutov 2017-09-09 23:55:44 +07:00
commit bc1ee39467

View file

@ -29,6 +29,11 @@ class PhpParallelLint extends Plugin implements ZeroConfigPluginInterface
*/
protected $extensions;
/**
* @var bool - enable short tags
*/
protected $shortTag;
/**
* @return string
*/
@ -41,6 +46,7 @@ class PhpParallelLint extends Plugin implements ZeroConfigPluginInterface
* $options['directory'] Output Directory. Default: %BUILDPATH%
* $options['filename'] Phar Filename. Default: build.phar
* $options['extensions'] Filename extensions. Default: php
* $options['shorttags'] Enable short tags. Default: false
* $options['stub'] Stub Content. No Default Value
*/
public function __construct(Builder $builder, Build $build, array $options = [])
@ -50,6 +56,7 @@ class PhpParallelLint extends Plugin implements ZeroConfigPluginInterface
$this->directory = $this->builder->buildPath;
$this->ignore = $this->builder->ignore;
$this->extensions = 'php';
$this->shortTag = false;
if (isset($options['directory'])) {
$this->directory = $this->builder->buildPath.$options['directory'];
@ -59,6 +66,10 @@ class PhpParallelLint extends Plugin implements ZeroConfigPluginInterface
$this->ignore = $options['ignore'];
}
if (isset($options['shorttags'])) {
$this->shortTag = (strtolower($options['shorttags']) == 'true');
}
if (isset($options['extensions'])) {
// Only use if this is a comma delimited list
$pattern = '/^([a-z]+)(,\ *[a-z]*)*$/';
@ -96,10 +107,11 @@ class PhpParallelLint extends Plugin implements ZeroConfigPluginInterface
$phplint = $this->findBinary('parallel-lint');
$cmd = $phplint . ' -e %s' . ' %s "%s"';
$cmd = $phplint . ' -e %s' . '%s %s "%s"';
$success = $this->builder->executeCommand(
$cmd,
$this->extensions,
($this->shortTag ? ' -s' : ''),
$ignore,
$this->directory
);