Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rework this for a bit more sensible operation.

  • Loading branch information...
commit c0d8a1a30c2c3412f99cd043c1d90247aa98811f 1 parent ecb225b
@damianb damianb authored
Showing with 14 additions and 11 deletions.
  1. +14 −11 phar-build.php
View
25 phar-build.php
@@ -185,27 +185,30 @@
if (!$iterator->isDot()) {
if ($file->isFile()) {
if($strip_regex !== NULL) {
+ $strip_match = false;
foreach ($strip_regex as $pattern) {
if (preg_match($pattern, $file->getFilename())) {
- if(!QUIET_MODE) {
- echo "adding " . $file . " and stripping whitespace & comments" . PHP_EOL;
- }
- $phar->addFromString(strip_from_beginning($options['src'], $file), php_strip_whitespace($file->getFilename()));
- } else {
- if(!QUIET_MODE) {
- echo "adding " . $file . PHP_EOL;
- }
- $phar->addFile($file, strip_from_beginning($options['src'], $file));
+ $strip_match = true;
+ break;
}
}
+ if ($strip_match) {
+ if(!QUIET_MODE) {
+ echo "adding " . $file . " and stripping whitespace & comments" . PHP_EOL;
+ }
+ $phar->addFromString(strip_from_beginning($options['src'], $file), php_strip_whitespace((string) $file));
+ } else {
+ if(!QUIET_MODE) {
+ echo "adding " . $file . PHP_EOL;
+ }
+ $phar->addFile($file, strip_from_beginning($options['src'], $file));
+ }
} else {
if(!QUIET_MODE) {
echo "adding " . $file . PHP_EOL;
}
$phar->addFile($file, strip_from_beginning($options['src'], $file));
}
-
- $phar->addFile($file, strip_from_beginning($options['src'], $file));
}
if ($file->isDir()) {
// this also doesn't work :(
Please sign in to comment.
Something went wrong with that request. Please try again.