| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/prosvasi/wp-content/plugins/wp-statistics/src/Traits/ |
Upload File : |
<?php
namespace WP_Statistics\Traits;
use WP_Statistics\Service\Debugger\Provider\ErrorsDetectorProvider;
/**
* Trait for handling error logging functionality.
*
* This trait provides methods for logging errors consistently across classes.
* Uses ErrorDetectorProvider to store errors and implements basic caching
* to avoid creating multiple provider instances.
*/
trait ErrorLoggerTrait
{
/**
* Cached instance of ErrorDetectorProvider.
*
* @var ErrorsDetectorProvider|null
*/
private static $errorDetector = null;
/**
* Log errors using ErrorsDetectorProvider
*
* Logs the most recent PHP error using a cached instance
* of ErrorsDetectorProvider to avoid multiple instantiations.
*
* @return void
*/
protected static function errorListener()
{
if (self::$errorDetector === null) {
self::$errorDetector = new ErrorsDetectorProvider();
}
self::$errorDetector->errorListener();
}
}