function drush_devel_container_services
Command callback to list available container services.
File
-
drush/
devel.drush8.inc, line 255
Code
function drush_devel_container_services($prefix = NULL) {
$container = Drupal::getContainer();
if (empty($container)) {
return drush_set_error(dt('No container was found.'));
}
// Get a list of all available service IDs.
$services = $container->getServiceIds();
// If there is a prefix, try to find matches.
if (isset($prefix)) {
$services = preg_grep("/{$prefix}/", $services);
}
if (empty($services)) {
return drush_log(dt('No container services found.'), 'ok');
}
sort($services);
return $services;
}