Add missing public visibility on methods of cache related classes
Change-Id: I8c85b6d7757c6b87ab0a72363c6d1571f0bfe67a
This commit is contained in:
parent
06a884c9ee
commit
5b55e2eded
9 changed files with 21 additions and 22 deletions
|
|
@ -22,7 +22,6 @@
|
|||
<!-- TODO Still to be done -->
|
||||
<rule ref="Squiz.Scope.MethodScope.Missing">
|
||||
<exclude-pattern>includes/actions/</exclude-pattern>
|
||||
<exclude-pattern>includes/cache/</exclude-pattern>
|
||||
<exclude-pattern>includes/deferred/</exclude-pattern>
|
||||
<exclude-pattern>includes/diff/</exclude-pattern>
|
||||
<exclude-pattern>includes/export/</exclude-pattern>
|
||||
|
|
|
|||
10
includes/cache/ICacheHelper.php
vendored
10
includes/cache/ICacheHelper.php
vendored
|
|
@ -34,7 +34,7 @@ interface ICacheHelper {
|
|||
* @since 1.20
|
||||
* @param bool $cacheEnabled
|
||||
*/
|
||||
function setCacheEnabled( $cacheEnabled );
|
||||
public function setCacheEnabled( $cacheEnabled );
|
||||
|
||||
/**
|
||||
* Initializes the caching.
|
||||
|
|
@ -45,7 +45,7 @@ interface ICacheHelper {
|
|||
* @param int|null $cacheExpiry Sets the cache expiry, either ttl in seconds or unix timestamp.
|
||||
* @param bool|null $cacheEnabled Sets if the cache should be enabled or not.
|
||||
*/
|
||||
function startCache( $cacheExpiry = null, $cacheEnabled = null );
|
||||
public function startCache( $cacheExpiry = null, $cacheEnabled = null );
|
||||
|
||||
/**
|
||||
* Get a cached value if available or compute it if not and then cache it if possible.
|
||||
|
|
@ -61,7 +61,7 @@ interface ICacheHelper {
|
|||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function getCachedValue( $computeFunction, $args = [], $key = null );
|
||||
public function getCachedValue( $computeFunction, $args = [], $key = null );
|
||||
|
||||
/**
|
||||
* Saves the HTML to the cache in case it got recomputed.
|
||||
|
|
@ -69,7 +69,7 @@ interface ICacheHelper {
|
|||
*
|
||||
* @since 1.20
|
||||
*/
|
||||
function saveCache();
|
||||
public function saveCache();
|
||||
|
||||
/**
|
||||
* Sets the time to live for the cache, in seconds or a unix timestamp
|
||||
|
|
@ -79,5 +79,5 @@ interface ICacheHelper {
|
|||
*
|
||||
* @param int $cacheExpiry
|
||||
*/
|
||||
function setExpiry( $cacheExpiry );
|
||||
public function setExpiry( $cacheExpiry );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ abstract class CacheDependency {
|
|||
/**
|
||||
* Returns true if the dependency is expired, false otherwise
|
||||
*/
|
||||
abstract function isExpired();
|
||||
abstract public function isExpired();
|
||||
|
||||
/**
|
||||
* Hook to perform any expensive pre-serialize loading of dependency values.
|
||||
*/
|
||||
function loadDependencyValues() {
|
||||
public function loadDependencyValues() {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class ConstantDependency extends CacheDependency {
|
|||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function isExpired() {
|
||||
public function isExpired() {
|
||||
return constant( $this->name ) != $this->value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
10
includes/cache/dependency/DependencyWrapper.php
vendored
10
includes/cache/dependency/DependencyWrapper.php
vendored
|
|
@ -52,7 +52,7 @@ class DependencyWrapper {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
function isExpired() {
|
||||
public function isExpired() {
|
||||
foreach ( $this->deps as $dep ) {
|
||||
if ( $dep->isExpired() ) {
|
||||
return true;
|
||||
|
|
@ -66,7 +66,7 @@ class DependencyWrapper {
|
|||
* Initialise dependency values in preparation for storing. This must be
|
||||
* called before serialization.
|
||||
*/
|
||||
function initialiseDeps() {
|
||||
public function initialiseDeps() {
|
||||
foreach ( $this->deps as $dep ) {
|
||||
$dep->loadDependencyValues();
|
||||
}
|
||||
|
|
@ -76,7 +76,7 @@ class DependencyWrapper {
|
|||
* Get the user-defined value
|
||||
* @return bool|mixed
|
||||
*/
|
||||
function getValue() {
|
||||
public function getValue() {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ class DependencyWrapper {
|
|||
* @param string $key
|
||||
* @param int $expiry
|
||||
*/
|
||||
function storeToCache( $cache, $key, $expiry = 0 ) {
|
||||
public function storeToCache( $cache, $key, $expiry = 0 ) {
|
||||
$this->initialiseDeps();
|
||||
$cache->set( $key, $this, $expiry );
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ class DependencyWrapper {
|
|||
* @return mixed The value, or null if it was not present in the cache and no
|
||||
* callback was defined.
|
||||
*/
|
||||
static function getValueFromCache( $cache, $key, $expiry = 0, $callback = false,
|
||||
public static function getValueFromCache( $cache, $key, $expiry = 0, $callback = false,
|
||||
$callbackParams = [], $deps = []
|
||||
) {
|
||||
$obj = $cache->get( $key );
|
||||
|
|
|
|||
4
includes/cache/dependency/FileDependency.php
vendored
4
includes/cache/dependency/FileDependency.php
vendored
|
|
@ -54,7 +54,7 @@ class FileDependency extends CacheDependency {
|
|||
return [ 'filename', 'timestamp' ];
|
||||
}
|
||||
|
||||
function loadDependencyValues() {
|
||||
public function loadDependencyValues() {
|
||||
if ( $this->timestamp === null ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
# Dependency on a non-existent file stores "false"
|
||||
|
|
@ -67,7 +67,7 @@ class FileDependency extends CacheDependency {
|
|||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function isExpired() {
|
||||
public function isExpired() {
|
||||
Wikimedia\suppressWarnings();
|
||||
$lastmod = filemtime( $this->filename );
|
||||
Wikimedia\restoreWarnings();
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class GlobalDependency extends CacheDependency {
|
|||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function isExpired() {
|
||||
public function isExpired() {
|
||||
if ( !isset( $GLOBALS[$this->name] ) ) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class MainConfigDependency extends CacheDependency {
|
|||
/**
|
||||
* @return bool
|
||||
*/
|
||||
function isExpired() {
|
||||
public function isExpired() {
|
||||
if ( !$this->getConfig()->has( $this->name ) ) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
8
includes/cache/localisation/LCStore.php
vendored
8
includes/cache/localisation/LCStore.php
vendored
|
|
@ -42,18 +42,18 @@ interface LCStore {
|
|||
* @param string $code Language code
|
||||
* @param string $key Cache key
|
||||
*/
|
||||
function get( $code, $key );
|
||||
public function get( $code, $key );
|
||||
|
||||
/**
|
||||
* Start a write transaction.
|
||||
* @param string $code Language code
|
||||
*/
|
||||
function startWrite( $code );
|
||||
public function startWrite( $code );
|
||||
|
||||
/**
|
||||
* Finish a write transaction.
|
||||
*/
|
||||
function finishWrite();
|
||||
public function finishWrite();
|
||||
|
||||
/**
|
||||
* Set a key to a given value. startWrite() must be called before this
|
||||
|
|
@ -61,6 +61,6 @@ interface LCStore {
|
|||
* @param string $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
function set( $key, $value );
|
||||
public function set( $key, $value );
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue