function drush_devel_container_services in Devel 8.2
Same name and namespace in other branches
- 8.3 drush/devel.drush8.inc \drush_devel_container_services()
- 8 drush/devel.drush8.inc \drush_devel_container_services()
Command callback to list available container services.
File
- drush/
devel.drush8.inc, line 266 - This file is only used by Drush8.
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;
}