mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 16:54:04 +02:00
Libraries: Return partial matches in method get()
This allows to reference libraries with only their project name, not just together with the organisation name.
This commit is contained in:
parent
e8fc6f93ae
commit
79478fd2e1
@ -74,10 +74,17 @@ class Libraries implements IteratorAggregate
|
||||
*/
|
||||
public function get($name)
|
||||
{
|
||||
$candidate = null;
|
||||
foreach ($this->libraries as $library) {
|
||||
if ($library->getName() === $name) {
|
||||
$libraryName = $library->getName();
|
||||
if ($libraryName === $name) {
|
||||
return $library;
|
||||
} elseif (explode('/', $libraryName)[1] === $name) {
|
||||
// Also return libs which only partially match
|
||||
$candidate = $library;
|
||||
}
|
||||
}
|
||||
|
||||
return $candidate;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user