Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
UserOptionsCacheEntry
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 canUseCachedValues
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace MediaWiki\User\Options;
4
5use IDBAccessObject;
6
7/**
8 * @internal
9 */
10class UserOptionsCacheEntry {
11    /**
12     * @var array<string,mixed> Values modified by setOption(), queued for update
13     */
14    public $modifiedValues = [];
15
16    /**
17     * @var array<string,string> The source name for each value in $originalValues
18     */
19    public $sources = [];
20
21    /**
22     * @var array<string,string> The value of the $global parameter to setOption()
23     */
24    public $globalUpdateActions = [];
25
26    /**
27     * @var array<string,string>|null Cached original user options with all the
28     *   adjustments like time correction and hook changes applied. Ready to be
29     *   returned. Null if the original values have not been loaded
30     */
31    public $originalValues;
32
33    /** @var int|null Query flags used to retrieve options from database */
34    public $recency;
35
36    /**
37     * Determine if it's OK to use cached options values for a given user and query flags
38     *
39     * @param int $recency
40     * @return bool
41     */
42    public function canUseCachedValues( $recency ) {
43        $recencyUsed = $this->recency ?? IDBAccessObject::READ_NONE;
44        return $recencyUsed >= $recency;
45    }
46}