Skip regex engine when not necessary
parent
21a9f21cc8
commit
467ece15ed
|
@ -190,10 +190,8 @@ EOT
|
||||||
|
|
||||||
// list packages
|
// list packages
|
||||||
$packages = array();
|
$packages = array();
|
||||||
if ($packageFilter) {
|
if (null !== $packageFilter) {
|
||||||
$packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
|
$packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
|
||||||
} else {
|
|
||||||
$packageFilter = '{.}';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($repos as $repo) {
|
foreach ($repos as $repo) {
|
||||||
|
@ -209,7 +207,7 @@ EOT
|
||||||
}
|
}
|
||||||
if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
|
if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
|
||||||
foreach ($repo->getProviderNames() as $name) {
|
foreach ($repo->getProviderNames() as $name) {
|
||||||
if (preg_match($packageFilter, $name)) {
|
if (!$packageFilter || preg_match($packageFilter, $name)) {
|
||||||
$packages[$type][$name] = $name;
|
$packages[$type][$name] = $name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,7 +217,7 @@ EOT
|
||||||
|| !is_object($packages[$type][$package->getName()])
|
|| !is_object($packages[$type][$package->getName()])
|
||||||
|| version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
|
|| 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;
|
$packages[$type][$package->getName()] = $package;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue