Completed
Push — master ( b58834...407387 )
by
unknown
02:37
created
src/Api/ResultsCache.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 	private $cache;
20 20
 
21 21
 	public static function getDefaultInstance() {
22
-		return new self( MediaWikiServices::getInstance()->getMainWANObjectCache() );
22
+		return new self(MediaWikiServices::getInstance()->getMainWANObjectCache());
23 23
 	}
24 24
 
25
-	public function __construct( WANObjectCache $cache ) {
25
+	public function __construct(WANObjectCache $cache) {
26 26
 		$this->cache = $cache;
27 27
 	}
28 28
 
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	 * @param string|null $languageCode defaults to user language
32 32
 	 * @return string cache key
33 33
 	 */
34
-	public function makeKey( EntityId $entityId, $languageCode = null ) {
34
+	public function makeKey(EntityId $entityId, $languageCode = null) {
35 35
 		global $wgLang, $wgContLang;
36
-		if ( $languageCode === null ) {
36
+		if ($languageCode === null) {
37 37
 			$languageCode = $wgLang->getCode();
38 38
 		}
39
-		if ( !Language::isKnownLanguageTag( $languageCode ) && $languageCode !== 'qqx' ) {
39
+		if (!Language::isKnownLanguageTag($languageCode) && $languageCode !== 'qqx') {
40 40
 			$languageCode = $wgContLang->getCode();
41 41
 		}
42 42
 		return $this->cache->makeKey(
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	 * @param float &$asOf
56 56
 	 * @return mixed
57 57
 	 */
58
-	public function get( EntityId $key, &$curTTL = null, array $checkKeys = [], &$asOf = null ) {
59
-		return $this->cache->get( $this->makeKey( $key ), $curTTL, $checkKeys, $asOf );
58
+	public function get(EntityId $key, &$curTTL = null, array $checkKeys = [], &$asOf = null) {
59
+		return $this->cache->get($this->makeKey($key), $curTTL, $checkKeys, $asOf);
60 60
 	}
61 61
 
62 62
 	/**
@@ -66,20 +66,20 @@  discard block
 block discarded – undo
66 66
 	 * @param array $opts
67 67
 	 * @return bool
68 68
 	 */
69
-	public function set( EntityId $key, $value, $ttl = 0, array $opts = [] ) {
70
-		return $this->cache->set( $this->makeKey( $key ), $value, $ttl, $opts );
69
+	public function set(EntityId $key, $value, $ttl = 0, array $opts = []) {
70
+		return $this->cache->set($this->makeKey($key), $value, $ttl, $opts);
71 71
 	}
72 72
 
73 73
 	/**
74 74
 	 * @param EntityId $key
75 75
 	 * @return bool
76 76
 	 */
77
-	public function delete( EntityId $key ) {
77
+	public function delete(EntityId $key) {
78 78
 		$ok = true;
79
-		$languageCodes = array_keys( Language::fetchLanguageNames( null, 'all' ) );
79
+		$languageCodes = array_keys(Language::fetchLanguageNames(null, 'all'));
80 80
 		$languageCodes[] = 'qqx';
81
-		foreach ( $languageCodes as $languageCode ) {
82
-			$ok = $this->cache->delete( $this->makeKey( $key, $languageCode ) ) && $ok;
81
+		foreach ($languageCodes as $languageCode) {
82
+			$ok = $this->cache->delete($this->makeKey($key, $languageCode)) && $ok;
83 83
 		}
84 84
 		return $ok;
85 85
 	}
Please login to merge, or discard this patch.