123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\NewRelicReporting\Model;
- /**
- * Wrapper for New Relic functions
- *
- * @codeCoverageIgnore
- */
- class NewRelicWrapper
- {
- /**
- * Wrapper for 'newrelic_add_custom_parameter' function
- *
- * @param string $param
- * @param string|int $value
- * @return bool
- */
- public function addCustomParameter($param, $value)
- {
- if (extension_loaded('newrelic')) {
- newrelic_add_custom_parameter($param, $value);
- return true;
- }
- return false;
- }
- /**
- * Wrapper for 'newrelic_notice_error' function
- *
- * @param \Exception $exception
- * @return void
- */
- public function reportError($exception)
- {
- if (extension_loaded('newrelic')) {
- newrelic_notice_error($exception->getMessage(), $exception);
- }
- }
- /**
- * Wrapper for 'newrelic_set_appname'
- *
- * @param string $appName
- * @return void
- */
- public function setAppName(string $appName)
- {
- if (extension_loaded('newrelic')) {
- newrelic_set_appname($appName);
- }
- }
- /**
- * Checks whether newrelic-php5 agent is installed
- *
- * @return bool
- */
- public function isExtensionInstalled()
- {
- if (extension_loaded('newrelic')) {
- return true;
- }
- return false;
- }
- }
|