mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 08:14:03 +02:00
Add paramater type to ResourceFactory::getResourceConfigs()
This allows to filter resources by type.
This commit is contained in:
parent
8f3ee4dedf
commit
4891afd646
@ -56,14 +56,25 @@ class ResourceFactory implements ConfigAwareFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the configuration of all existing resources, or get all resources of a given type.
|
* Get the configuration of all existing resources, or all resources of the given type
|
||||||
*
|
*
|
||||||
* @return Config The configuration containing all resources
|
* @param string $type Filter for resource type
|
||||||
|
*
|
||||||
|
* @return Config The resources configuration
|
||||||
*/
|
*/
|
||||||
public static function getResourceConfigs()
|
public static function getResourceConfigs($type = null)
|
||||||
{
|
{
|
||||||
self::assertResourcesExist();
|
self::assertResourcesExist();
|
||||||
return self::$resources;
|
if ($type === null) {
|
||||||
|
return self::$resources;
|
||||||
|
}
|
||||||
|
$resources = array();
|
||||||
|
foreach (self::$resources as $name => $resource) {
|
||||||
|
if ($resource->get('type') === $type) {
|
||||||
|
$resources[$name] = $resource;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Config::fromArray($resources);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user