Completed
Push — master ( 866e51...05d0de )
by
unknown
02:58 queued 10s
created
src/Api/ResultsCache.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @param WANObjectCache $cache
38 38
 	 * @param string $formatVersion The version of the API response format.
39 39
 	 */
40
-	public function __construct( WANObjectCache $cache, $formatVersion ) {
40
+	public function __construct(WANObjectCache $cache, $formatVersion) {
41 41
 		$this->cache = $cache;
42 42
 		$this->formatVersion = $formatVersion;
43 43
 	}
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 	 * @param string|null $languageCode defaults to user language
48 48
 	 * @return string cache key
49 49
 	 */
50
-	public function makeKey( EntityId $entityId, $languageCode = null ) {
50
+	public function makeKey(EntityId $entityId, $languageCode = null) {
51 51
 		global $wgLang, $wgContLang;
52
-		if ( $languageCode === null ) {
52
+		if ($languageCode === null) {
53 53
 			$languageCode = $wgLang->getCode();
54 54
 		}
55
-		if ( !Language::isKnownLanguageTag( $languageCode ) && $languageCode !== 'qqx' ) {
55
+		if (!Language::isKnownLanguageTag($languageCode) && $languageCode !== 'qqx') {
56 56
 			$languageCode = $wgContLang->getCode();
57 57
 		}
58 58
 		return $this->cache->makeKey(
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	 * @param float &$asOf
72 72
 	 * @return mixed
73 73
 	 */
74
-	public function get( EntityId $key, &$curTTL = null, array $checkKeys = [], &$asOf = null ) {
75
-		return $this->cache->get( $this->makeKey( $key ), $curTTL, $checkKeys, $asOf );
74
+	public function get(EntityId $key, &$curTTL = null, array $checkKeys = [], &$asOf = null) {
75
+		return $this->cache->get($this->makeKey($key), $curTTL, $checkKeys, $asOf);
76 76
 	}
77 77
 
78 78
 	/**
@@ -82,20 +82,20 @@  discard block
 block discarded – undo
82 82
 	 * @param array $opts
83 83
 	 * @return bool
84 84
 	 */
85
-	public function set( EntityId $key, $value, $ttl = 0, array $opts = [] ) {
86
-		return $this->cache->set( $this->makeKey( $key ), $value, $ttl, $opts );
85
+	public function set(EntityId $key, $value, $ttl = 0, array $opts = []) {
86
+		return $this->cache->set($this->makeKey($key), $value, $ttl, $opts);
87 87
 	}
88 88
 
89 89
 	/**
90 90
 	 * @param EntityId $key
91 91
 	 * @return bool
92 92
 	 */
93
-	public function delete( EntityId $key ) {
93
+	public function delete(EntityId $key) {
94 94
 		$ok = true;
95
-		$languageCodes = array_keys( Language::fetchLanguageNames( null, 'all' ) );
95
+		$languageCodes = array_keys(Language::fetchLanguageNames(null, 'all'));
96 96
 		$languageCodes[] = 'qqx';
97
-		foreach ( $languageCodes as $languageCode ) {
98
-			$ok = $this->cache->delete( $this->makeKey( $key, $languageCode ) ) && $ok;
97
+		foreach ($languageCodes as $languageCode) {
98
+			$ok = $this->cache->delete($this->makeKey($key, $languageCode)) && $ok;
99 99
 		}
100 100
 		return $ok;
101 101
 	}
Please login to merge, or discard this patch.
src/Api/CheckResultsRenderer.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 	 * @param CachedCheckResults $checkResults
60 60
 	 * @return CachedCheckConstraintsResponse
61 61
 	 */
62
-	public function render( CachedCheckResults $checkResults ) {
62
+	public function render(CachedCheckResults $checkResults) {
63 63
 		$response = [];
64
-		foreach ( $checkResults->getArray() as $checkResult ) {
65
-			$resultArray = $this->checkResultToArray( $checkResult );
66
-			$checkResult->getContextCursor()->storeCheckResultInArray( $resultArray, $response );
64
+		foreach ($checkResults->getArray() as $checkResult) {
65
+			$resultArray = $this->checkResultToArray($checkResult);
66
+			$checkResult->getContextCursor()->storeCheckResultInArray($resultArray, $response);
67 67
 		}
68 68
 		return new CachedCheckConstraintsResponse(
69 69
 			$response,
@@ -71,19 +71,19 @@  discard block
 block discarded – undo
71 71
 		);
72 72
 	}
73 73
 
74
-	public function checkResultToArray( CheckResult $checkResult ) {
75
-		if ( $checkResult instanceof NullResult ) {
74
+	public function checkResultToArray(CheckResult $checkResult) {
75
+		if ($checkResult instanceof NullResult) {
76 76
 			return null;
77 77
 		}
78 78
 
79 79
 		$constraintId = $checkResult->getConstraint()->getConstraintId();
80 80
 		$typeItemId = $checkResult->getConstraint()->getConstraintTypeItemId();
81
-		$constraintPropertyId = new PropertyId( $checkResult->getContextCursor()->getSnakPropertyId() );
81
+		$constraintPropertyId = new PropertyId($checkResult->getContextCursor()->getSnakPropertyId());
82 82
 
83
-		$title = $this->entityTitleLookup->getTitleForId( $constraintPropertyId );
84
-		$typeLabel = $this->entityIdLabelFormatter->formatEntityId( new ItemId( $typeItemId ) );
83
+		$title = $this->entityTitleLookup->getTitleForId($constraintPropertyId);
84
+		$typeLabel = $this->entityIdLabelFormatter->formatEntityId(new ItemId($typeItemId));
85 85
 		// TODO link to the statement when possible (T169224)
86
-		$link = $title->getFullURL() . '#' . $this->config->get( 'WBQualityConstraintsPropertyConstraintId' );
86
+		$link = $title->getFullURL().'#'.$this->config->get('WBQualityConstraintsPropertyConstraintId');
87 87
 
88 88
 		$constraint = [
89 89
 			'id' => $constraintId,
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
 			'constraint' => $constraint
100 100
 		];
101 101
 		$message = $checkResult->getMessage();
102
-		if ( $message ) {
103
-			$result['message-html'] = $this->violationMessageRenderer->render( $message );
102
+		if ($message) {
103
+			$result['message-html'] = $this->violationMessageRenderer->render($message);
104 104
 		}
105
-		if ( $checkResult->getContextCursor()->getType() === Context::TYPE_STATEMENT ) {
105
+		if ($checkResult->getContextCursor()->getType() === Context::TYPE_STATEMENT) {
106 106
 			$result['claim'] = $checkResult->getContextCursor()->getStatementGuid();
107 107
 		}
108 108
 		$cachingMetadataArray = $checkResult->getMetadata()->getCachingMetadata()->toArray();
109
-		if ( $cachingMetadataArray !== null ) {
109
+		if ($cachingMetadataArray !== null) {
110 110
 			$result['cached'] = $cachingMetadataArray;
111 111
 		}
112 112
 
Please login to merge, or discard this patch.