1
0
Fork 0

Skip regex engine when not necessary

pull/5220/head
Jordi Boggiano 2016-04-19 11:53:24 +01:00
parent 21a9f21cc8
commit 467ece15ed
1 changed files with 3 additions and 5 deletions

View File

@ -190,10 +190,8 @@ EOT
// list packages
$packages = array();
if ($packageFilter) {
if (null !== $packageFilter) {
$packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
} else {
$packageFilter = '{.}';
}
foreach ($repos as $repo) {
@ -209,7 +207,7 @@ EOT
}
if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
foreach ($repo->getProviderNames() as $name) {
if (preg_match($packageFilter, $name)) {
if (!$packageFilter || preg_match($packageFilter, $name)) {
$packages[$type][$name] = $name;
}
}
@ -219,7 +217,7 @@ EOT
|| !is_object($packages[$type][$package->getName()])
|| version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
) {
if (preg_match($packageFilter, $package->getName())) {
if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
$packages[$type][$package->getName()] = $package;
}
}