Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP-Parallel-Lint shorttags option #1338

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion PHPCI/Plugin/PhpParallelLint.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@ class PhpParallelLint implements \PHPCI\Plugin
*/
protected $extensions;

/**
* @var bool - enable short tags
*/
protected $shortTag;

/**
* Standard Constructor
*
* $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
*
* @param Builder $phpci
Expand All @@ -65,6 +71,7 @@ public function __construct(Builder $phpci, Build $build, array $options = array
$this->directory = $phpci->buildPath;
$this->ignore = $this->phpci->ignore;
$this->extensions = 'php';
$this->shortTag = false;

if (isset($options['directory'])) {
$this->directory = $phpci->buildPath.$options['directory'];
Expand All @@ -74,6 +81,10 @@ public function __construct(Builder $phpci, Build $build, array $options = array
$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]*$/';
Expand All @@ -93,10 +104,11 @@ public function execute()

$phplint = $this->phpci->findBinary('parallel-lint');

$cmd = $phplint . ' -e %s' . ' %s "%s"';
$cmd = $phplint . ' -e %s' . '%s %s "%s"';
$success = $this->phpci->executeCommand(
$cmd,
$this->extensions,
($this->shortTag ? ' -s' : ''),
$ignore,
$this->directory
);
Expand Down