MediaWiki fundraising/REL1_35
DonationProfiler Class Reference

Records duration of various operations. More...

Public Member Functions

 __construct (LoggerInterface $logger, $commLogger, $gatewayName)
 DonationProfiler constructor.
 
 getStopwatch ( $string, $reset=false)
 getStopwatch keeps track of how long things take, for logging, output, determining if we should loop on some method again... whatever.
 
 saveCommunicationStats ( $function='', $additional='', $vars='')
 

Protected Attributes

 $commLogger
 
 $gatewayName
 
 $logger
 

Static Protected Attributes

static array $start = []
 The microtime at which each stopwatch was started.
 

Detailed Description

Records duration of various operations.

Definition at line 9 of file DonationProfiler.php.

Constructor & Destructor Documentation

◆ __construct()

DonationProfiler::__construct ( LoggerInterface $logger,
$commLogger,
$gatewayName )

DonationProfiler constructor.

Parameters
LoggerInterface$loggerUsed to record time at each getStopwatch call
LoggerInterface | null$commLoggerIf not null, used to record communications statistics
string$gatewayNameidentifier

Definition at line 25 of file DonationProfiler.php.

References $commLogger, $gatewayName, and $logger.

Member Function Documentation

◆ getStopwatch()

DonationProfiler::getStopwatch ( $string,
$reset = false )

getStopwatch keeps track of how long things take, for logging, output, determining if we should loop on some method again... whatever.

Parameters
string$stringSome identifier for each stopwatch value we want to keep. Each unique $string passed in will get its own value in $start.
bool$resetIf this is set to true, it will reset any $start value recorded for the $string identifier.
Returns
float The difference in microtime (rounded to 4 decimal places) between the $start value, and now.

Definition at line 41 of file DonationProfiler.php.

References $start.

Referenced by saveCommunicationStats().

◆ saveCommunicationStats()

DonationProfiler::saveCommunicationStats ( $function = '',
$additional = '',
$vars = '' )
Parameters
string$functionThis is the function name that identifies the stopwatch that should have already been started with the profiler.
string$additionalAdditional information about the thing we're currently timing. Meant to be easily searchable.
string$varsIntended to be particular values of any variables that might be of interest.

Definition at line 60 of file DonationProfiler.php.

References $gatewayName, and getStopwatch().

Member Data Documentation

◆ $commLogger

DonationProfiler::$commLogger
protected

Definition at line 11 of file DonationProfiler.php.

Referenced by __construct().

◆ $gatewayName

DonationProfiler::$gatewayName
protected

Definition at line 12 of file DonationProfiler.php.

Referenced by __construct(), and saveCommunicationStats().

◆ $logger

DonationProfiler::$logger
protected

Definition at line 10 of file DonationProfiler.php.

Referenced by __construct().

◆ $start

array DonationProfiler::$start = []
staticprotected

The microtime at which each stopwatch was started.

Definition at line 17 of file DonationProfiler.php.

Referenced by getStopwatch().


The documentation for this class was generated from the following file: