MediaWiki
REL1_40
LimitCondition.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Wikimedia\WRStats
;
4
9
class
LimitCondition
{
11
public
$limit
;
13
public
$window
;
14
20
public
function
__construct
(
$limit
,
$window
) {
21
$this->limit = (int)
$limit
;
22
$this->window = +
$window
;
23
if
( $this->window <= 0 ) {
24
throw
new
WRStatsError
( __METHOD__ .
25
': window must be positive'
);
26
}
27
}
28
34
public
function
perSecond
() {
35
return
$this->limit /
$this->window
;
36
}
37
}
Wikimedia\WRStats\LimitCondition
Definition
LimitCondition.php:9
Wikimedia\WRStats\LimitCondition\$window
float int $window
The number of seconds over which the number of events may occur.
Definition
LimitCondition.php:13
Wikimedia\WRStats\LimitCondition\$limit
int $limit
The maximum number of events.
Definition
LimitCondition.php:11
Wikimedia\WRStats\LimitCondition\perSecond
perSecond()
Get the condition as a number of events per second.
Definition
LimitCondition.php:34
Wikimedia\WRStats\LimitCondition\__construct
__construct( $limit, $window)
Definition
LimitCondition.php:20
Wikimedia\WRStats\WRStatsError
Exception class for errors thrown by the WRStats library.
Definition
WRStatsError.php:10
Wikimedia\WRStats
Definition
ArrayStatsStore.php:3
includes
libs
WRStats
LimitCondition.php
Generated on Thu Jun 27 2024 14:03:20 for MediaWiki by
1.10.0