Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
LimitOperation | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Wikimedia\WRStats; |
4 | |
5 | /** |
6 | * One item in a LimitBatch. |
7 | * |
8 | * To perform a single operation, it is generally recommended to use |
9 | * the simpler interface of WRStatsRateLimiter::peek(), ::incr(), and |
10 | * ::tryIncr() instead of constructing LimitOperation objects. |
11 | * |
12 | * @newable |
13 | * @since 1.39 |
14 | */ |
15 | class LimitOperation { |
16 | /** @var string */ |
17 | public $condName; |
18 | /** @var EntityKey */ |
19 | public $entityKey; |
20 | /** @var int */ |
21 | public $amount; |
22 | |
23 | /** |
24 | * @param string $condName |
25 | * @param EntityKey|null $entityKey |
26 | * @param int $amount |
27 | */ |
28 | public function __construct( |
29 | string $condName, |
30 | EntityKey $entityKey = null, |
31 | $amount = 1 |
32 | ) { |
33 | $this->condName = $condName; |
34 | $this->entityKey = $entityKey ?? new LocalEntityKey; |
35 | $this->amount = $amount; |
36 | } |
37 | } |