You are here

class AdapterFactory in New Relic 8

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

Factory to create a New Relic adapter.

Hierarchy

Expanded class hierarchy of AdapterFactory

File

src/ExtensionAdapter/AdapterFactory.php, line 8

Namespace

Drupal\new_relic_rpm\ExtensionAdapter
View source
class AdapterFactory {

  /**
   * Returns a new relic adapter.
   *
   * If the extension is not enabled, a null implementation is returned
   * to prevent errors.
   *
   * @return \Drupal\new_relic_rpm\ExtensionAdapter\NewRelicAdapterInterface
   *   The new relic adapter.
   */
  public static function getAdapter() {
    if (extension_loaded('newrelic')) {
      return new ExtensionAdapter();
    }
    else {
      return new NullAdapter();
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AdapterFactory::getAdapter public static function Returns a new relic adapter.