protected function HttpServiceApiHandler::buildServicesApiYaml in HTTP Client Manager 8
Same name and namespace in other branches
- 8.2 src/HttpServiceApiHandler.php \Drupal\http_client_manager\HttpServiceApiHandler::buildServicesApiYaml()
Builds all services api provided by .http_services_api.yml files.
example_service:
title: "Example Service"
api_path: src/HttpService/example_service.json
base_url: "http://www.example.com/api/v1"
config:
command.params:
command.request_options:
timeout: 4
connect_timeout: 3
Return value
array[] Each return api is an array with the following keys:
- id: The machine name of the Service Api.
- title: The human-readable name of the API.
- api_path: The Guzzle description path (relative to module directory).
- base_url: The Service API base url.
- provider: The provider module of the Service Api.
- source: The absolute path to the Service API description file.
- config: An array of additional configurations for the HttpClient class.
1 call to HttpServiceApiHandler::buildServicesApiYaml()
- HttpServiceApiHandler::getServicesApi in src/
HttpServiceApiHandler.php - Gets all available services Api.
File
- src/
HttpServiceApiHandler.php, line 154
Class
- HttpServiceApiHandler
- Class HttpServiceApiHandler.
Namespace
Drupal\http_client_managerCode
protected function buildServicesApiYaml() {
$this->servicesApi = array();
$items = $this
->getYamlDiscovery()
->findAll();
foreach ($items as $provider => $servicesApi) {
$module_path = $this->moduleHandler
->getModule($provider)
->getPath();
foreach ($servicesApi as $id => $serviceApi) {
$this
->overrideServiceApiDefinition($id, $serviceApi);
$this
->validateServiceApiDefinition($id, $serviceApi);
$default = [
'id' => $id,
'provider' => $provider,
'source' => $this->root . '/' . $module_path . '/' . $serviceApi['api_path'],
'config' => [],
];
$this->servicesApi[$id] = array_merge($default, $serviceApi);
}
}
}