You are here

public function DevelKintApiClientProfiler::__construct in Apigee Edge 8

DevelKintApiClientProfiler constructor.

Parameters

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: Config factory.

\Drupal\apigee_edge_debug\DebugMessageFormatterPluginManager $debug_message_formatter_plugin: Debug message formatter plugin manager.

\Drupal\Core\Session\AccountInterface $currentUser: The currently logged-in user.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler service.

\Drupal\Core\Messenger\MessengerInterface $messenger: The messenger service.

File

modules/apigee_edge_debug/src/HttpClientMiddleware/DevelKintApiClientProfiler.php, line 81

Class

DevelKintApiClientProfiler
Http client middleware that profiles Apigee Edge API calls.

Namespace

Drupal\apigee_edge_debug\HttpClientMiddleware

Code

public function __construct(ConfigFactoryInterface $config_factory, DebugMessageFormatterPluginManager $debug_message_formatter_plugin, AccountInterface $currentUser, ModuleHandlerInterface $module_handler, MessengerInterface $messenger) {

  // On module install, this constructor is called earlier than
  // the module's configuration would have been imported to the database.
  // In that case the $formatterPluginId is missing and it causes fatal
  // errors.
  $formatter_plugin_id = $config_factory
    ->get('apigee_edge_debug.settings')
    ->get('formatter');
  if ($formatter_plugin_id) {
    $this->formatter = $debug_message_formatter_plugin
      ->createInstance($formatter_plugin_id);
  }
  $this->currentUser = $currentUser;
  $this->moduleHandler = $module_handler;
  $this->messenger = $messenger;
}