You are here

public static function AdapterFactory::getAdapter in New Relic 2.x

Same name and namespace in other branches
  1. 8 src/ExtensionAdapter/AdapterFactory.php \Drupal\new_relic_rpm\ExtensionAdapter\AdapterFactory::getAdapter()
  2. 2.0.x src/ExtensionAdapter/AdapterFactory.php \Drupal\new_relic_rpm\ExtensionAdapter\AdapterFactory::getAdapter()

Returns a new relic adapter.

If the extension is not enabled, a null implementation is returned to prevent errors.

Return value

\Drupal\new_relic_rpm\ExtensionAdapter\NewRelicAdapterInterface The new relic adapter.

1 string reference to 'AdapterFactory::getAdapter'
new_relic_rpm.services.yml in ./new_relic_rpm.services.yml
new_relic_rpm.services.yml

File

src/ExtensionAdapter/AdapterFactory.php, line 19

Class

AdapterFactory
Factory to create a New Relic adapter.

Namespace

Drupal\new_relic_rpm\ExtensionAdapter

Code

public static function getAdapter() {
  if (extension_loaded('newrelic')) {
    return new ExtensionAdapter();
  }
  else {
    return new NullAdapter();
  }
}