Completed
Push — master ( 37682c...11e3bd )
by
unknown
02:09
created
src/ConstraintCheck/Context/QualifierContextCursor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -80,29 +80,29 @@
 block discarded – undo
80 80
 		return $this->snakHash;
81 81
 	}
82 82
 
83
-	protected function &getMainArray( array &$container ) {
84
-		$statementArray = &$this->getStatementArray( $container );
83
+	protected function &getMainArray(array &$container) {
84
+		$statementArray = &$this->getStatementArray($container);
85 85
 
86
-		if ( !array_key_exists( 'qualifiers', $statementArray ) ) {
86
+		if (!array_key_exists('qualifiers', $statementArray)) {
87 87
 			$statementArray['qualifiers'] = [];
88 88
 		}
89 89
 		$qualifiersArray = &$statementArray['qualifiers'];
90 90
 
91 91
 		$snakPropertyId = $this->getSnakPropertyId();
92
-		if ( !array_key_exists( $snakPropertyId, $qualifiersArray ) ) {
92
+		if (!array_key_exists($snakPropertyId, $qualifiersArray)) {
93 93
 			$qualifiersArray[$snakPropertyId] = [];
94 94
 		}
95 95
 		$propertyArray = &$qualifiersArray[$snakPropertyId];
96 96
 
97 97
 		$snakHash = $this->getSnakHash();
98
-		foreach ( $propertyArray as &$potentialQualifierArray ) {
99
-			if ( $potentialQualifierArray['hash'] === $snakHash ) {
98
+		foreach ($propertyArray as &$potentialQualifierArray) {
99
+			if ($potentialQualifierArray['hash'] === $snakHash) {
100 100
 				$qualifierArray = &$potentialQualifierArray;
101 101
 				break;
102 102
 			}
103 103
 		}
104
-		if ( !isset( $qualifierArray ) ) {
105
-			$qualifierArray = [ 'hash' => $snakHash ];
104
+		if (!isset($qualifierArray)) {
105
+			$qualifierArray = ['hash' => $snakHash];
106 106
 			$propertyArray[] = &$qualifierArray;
107 107
 		}
108 108
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/MainSnakContextCursor.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,12 +72,12 @@
 block discarded – undo
72 72
 		return $this->snakHash;
73 73
 	}
74 74
 
75
-	protected function &getMainArray( array &$container ) {
76
-		$statementArray = &$this->getStatementArray( $container );
75
+	protected function &getMainArray(array &$container) {
76
+		$statementArray = &$this->getStatementArray($container);
77 77
 
78
-		if ( !array_key_exists( 'mainsnak', $statementArray ) ) {
78
+		if (!array_key_exists('mainsnak', $statementArray)) {
79 79
 			$snakHash = $this->getSnakHash();
80
-			$statementArray['mainsnak'] = [ 'hash' => $snakHash ];
80
+			$statementArray['mainsnak'] = ['hash' => $snakHash];
81 81
 		}
82 82
 		$mainsnakArray = &$statementArray['mainsnak'];
83 83
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/ApiV2ContextCursor.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
 	 * @param array[] &$container
28 28
 	 * @return array
29 29
 	 */
30
-	protected function &getStatementArray( array &$container ) {
30
+	protected function &getStatementArray(array &$container) {
31 31
 		$entityId = $this->getEntityId();
32 32
 		$statementPropertyId = $this->getStatementPropertyId();
33 33
 		$statementGuid = $this->getStatementGuid();
34 34
 
35
-		if ( !array_key_exists( $entityId, $container ) ) {
35
+		if (!array_key_exists($entityId, $container)) {
36 36
 			$container[$entityId] = [];
37 37
 		}
38 38
 		$entityContainer = &$container[$entityId];
39 39
 
40
-		if ( !array_key_exists( 'claims', $entityContainer ) ) {
40
+		if (!array_key_exists('claims', $entityContainer)) {
41 41
 			$entityContainer['claims'] = [];
42 42
 		}
43 43
 		$claimsContainer = &$entityContainer['claims'];
44 44
 
45
-		if ( !array_key_exists( $statementPropertyId, $claimsContainer ) ) {
45
+		if (!array_key_exists($statementPropertyId, $claimsContainer)) {
46 46
 			$claimsContainer[$statementPropertyId] = [];
47 47
 		}
48 48
 		$propertyContainer = &$claimsContainer[$statementPropertyId];
49 49
 
50
-		foreach ( $propertyContainer as &$statement ) {
51
-			if ( $statement['id'] === $statementGuid ) {
50
+		foreach ($propertyContainer as &$statement) {
51
+			if ($statement['id'] === $statementGuid) {
52 52
 				$statementArray = &$statement;
53 53
 				break;
54 54
 			}
55 55
 		}
56
-		if ( !isset( $statementArray ) ) {
57
-			$statementArray = [ 'id' => $statementGuid ];
56
+		if (!isset($statementArray)) {
57
+			$statementArray = ['id' => $statementGuid];
58 58
 			$propertyContainer[] = &$statementArray;
59 59
 		}
60 60
 
@@ -69,19 +69,19 @@  discard block
 block discarded – undo
69 69
 	 * @param array[] &$container
70 70
 	 * @return array
71 71
 	 */
72
-	abstract protected function &getMainArray( array &$container );
72
+	abstract protected function &getMainArray(array &$container);
73 73
 
74 74
 	/**
75 75
 	 * @param array|null $result
76 76
 	 * @param array[] &$container
77 77
 	 */
78
-	public function storeCheckResultInArray( array $result = null, array &$container ) {
79
-		$mainArray = &$this->getMainArray( $container );
80
-		if ( !array_key_exists( 'results', $mainArray ) ) {
78
+	public function storeCheckResultInArray(array $result = null, array &$container) {
79
+		$mainArray = &$this->getMainArray($container);
80
+		if (!array_key_exists('results', $mainArray)) {
81 81
 			$mainArray['results'] = [];
82 82
 		}
83 83
 
84
-		if ( $result !== null ) {
84
+		if ($result !== null) {
85 85
 			$mainArray['results'][] = $result;
86 86
 		}
87 87
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/ContextCursorSerializer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	 * @param ContextCursor $cursor
14 14
 	 * @return array
15 15
 	 */
16
-	public function serialize( ContextCursor $cursor ) {
16
+	public function serialize(ContextCursor $cursor) {
17 17
 		$type = $cursor->getType();
18 18
 		$serialization = [
19 19
 			't' => $type,
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 			'h' => $cursor->getSnakHash(),
24 24
 		];
25 25
 
26
-		if ( $type === Context::TYPE_QUALIFIER || $type === Context::TYPE_REFERENCE ) {
26
+		if ($type === Context::TYPE_QUALIFIER || $type === Context::TYPE_REFERENCE) {
27 27
 			$serialization['P'] = $cursor->getSnakPropertyId();
28
-			if ( $type === Context::TYPE_REFERENCE ) {
28
+			if ($type === Context::TYPE_REFERENCE) {
29 29
 				/** @var ReferenceContextCursor $cursor */
30 30
 				$serialization['r'] = $cursor->getReferenceHash();
31 31
 			}
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/ContextCursorDeserializer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
  */
12 12
 class ContextCursorDeserializer {
13 13
 
14
-	public function deserialize( array $serialization ) {
15
-		switch ( $serialization['t'] ) {
14
+	public function deserialize(array $serialization) {
15
+		switch ($serialization['t']) {
16 16
 			case Context::TYPE_STATEMENT:
17 17
 				return new MainSnakContextCursor(
18 18
 					$serialization['i'],
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 				);
40 40
 			default:
41 41
 				throw new InvalidArgumentException(
42
-					'Unknown serialization type ' . $serialization['t']
42
+					'Unknown serialization type '.$serialization['t']
43 43
 				);
44 44
 		}
45 45
 	}
Please login to merge, or discard this patch.
src/Api/CheckingResultsBuilder.php 1 patch
Spacing   +28 added lines, -29 removed lines patch added patch discarded remove patch
@@ -84,65 +84,64 @@  discard block
 block discarded – undo
84 84
 	) {
85 85
 		$response = [];
86 86
 		$metadatas = [];
87
-		$statusesFlipped = array_flip( $statuses );
88
-		foreach ( $entityIds as $entityId ) {
87
+		$statusesFlipped = array_flip($statuses);
88
+		foreach ($entityIds as $entityId) {
89 89
 			$results = $this->delegatingConstraintChecker->checkAgainstConstraintsOnEntityId(
90 90
 				$entityId,
91 91
 				$constraintIds,
92
-				[ $this, 'defaultResults' ]
92
+				[$this, 'defaultResults']
93 93
 			);
94
-			foreach ( $results as $result ) {
94
+			foreach ($results as $result) {
95 95
 				$metadatas[] = $result->getMetadata();
96
-				if ( $this->statusSelected( $statusesFlipped, $result ) ) {
97
-					$resultArray = $this->checkResultToArray( $result );
98
-					$result->getContextCursor()->storeCheckResultInArray( $resultArray, $response );
96
+				if ($this->statusSelected($statusesFlipped, $result)) {
97
+					$resultArray = $this->checkResultToArray($result);
98
+					$result->getContextCursor()->storeCheckResultInArray($resultArray, $response);
99 99
 				}
100 100
 			}
101 101
 		}
102
-		foreach ( $claimIds as $claimId ) {
102
+		foreach ($claimIds as $claimId) {
103 103
 			$results = $this->delegatingConstraintChecker->checkAgainstConstraintsOnClaimId(
104 104
 				$claimId,
105 105
 				$constraintIds,
106
-				[ $this, 'defaultResults' ]
106
+				[$this, 'defaultResults']
107 107
 			);
108
-			foreach ( $results as $result ) {
108
+			foreach ($results as $result) {
109 109
 				$metadatas[] = $result->getMetadata();
110
-				if ( $this->statusSelected( $statusesFlipped, $result ) ) {
111
-					$resultArray = $this->checkResultToArray( $result );
112
-					$result->getContextCursor()->storeCheckResultInArray( $resultArray, $response );
110
+				if ($this->statusSelected($statusesFlipped, $result)) {
111
+					$resultArray = $this->checkResultToArray($result);
112
+					$result->getContextCursor()->storeCheckResultInArray($resultArray, $response);
113 113
 				}
114 114
 			}
115 115
 		}
116 116
 		return new CachedCheckConstraintsResponse(
117 117
 			$response,
118
-			Metadata::merge( $metadatas )
118
+			Metadata::merge($metadatas)
119 119
 		);
120 120
 	}
121 121
 
122
-	public function defaultResults( Context $context ) {
122
+	public function defaultResults(Context $context) {
123 123
 		return $context->getType() === Context::TYPE_STATEMENT ?
124
-			[ new NullResult( $context ) ] :
125
-			[];
124
+			[new NullResult($context)] : [];
126 125
 	}
127 126
 
128
-	public function statusSelected( array $statusesFlipped, CheckResult $result ) {
129
-		return array_key_exists( $result->getStatus(), $statusesFlipped ) ||
127
+	public function statusSelected(array $statusesFlipped, CheckResult $result) {
128
+		return array_key_exists($result->getStatus(), $statusesFlipped) ||
130 129
 			$result instanceof NullResult;
131 130
 	}
132 131
 
133
-	public function checkResultToArray( CheckResult $checkResult ) {
134
-		if ( $checkResult instanceof NullResult ) {
132
+	public function checkResultToArray(CheckResult $checkResult) {
133
+		if ($checkResult instanceof NullResult) {
135 134
 			return null;
136 135
 		}
137 136
 
138 137
 		$constraintId = $checkResult->getConstraint()->getConstraintId();
139 138
 		$typeItemId = $checkResult->getConstraint()->getConstraintTypeItemId();
140
-		$constraintPropertyId = new PropertyId( $checkResult->getContextCursor()->getSnakPropertyId() );
139
+		$constraintPropertyId = new PropertyId($checkResult->getContextCursor()->getSnakPropertyId());
141 140
 
142
-		$title = $this->entityTitleLookup->getTitleForId( $constraintPropertyId );
143
-		$typeLabel = $this->entityIdLabelFormatter->formatEntityId( new ItemId( $typeItemId ) );
141
+		$title = $this->entityTitleLookup->getTitleForId($constraintPropertyId);
142
+		$typeLabel = $this->entityIdLabelFormatter->formatEntityId(new ItemId($typeItemId));
144 143
 		// TODO link to the statement when possible (T169224)
145
-		$link = $title->getFullURL() . '#' . $this->config->get( 'WBQualityConstraintsPropertyConstraintId' );
144
+		$link = $title->getFullURL().'#'.$this->config->get('WBQualityConstraintsPropertyConstraintId');
146 145
 
147 146
 		$constraint = [
148 147
 			'id' => $constraintId,
@@ -158,14 +157,14 @@  discard block
 block discarded – undo
158 157
 			'constraint' => $constraint
159 158
 		];
160 159
 		$message = $checkResult->getMessage();
161
-		if ( $message ) {
162
-			$result['message-html'] = $this->violationMessageRenderer->render( $message );
160
+		if ($message) {
161
+			$result['message-html'] = $this->violationMessageRenderer->render($message);
163 162
 		}
164
-		if ( $checkResult->getContextCursor()->getType() === Context::TYPE_STATEMENT ) {
163
+		if ($checkResult->getContextCursor()->getType() === Context::TYPE_STATEMENT) {
165 164
 			$result['claim'] = $checkResult->getContextCursor()->getStatementGuid();
166 165
 		}
167 166
 		$cachingMetadataArray = $checkResult->getMetadata()->getCachingMetadata()->toArray();
168
-		if ( $cachingMetadataArray !== null ) {
167
+		if ($cachingMetadataArray !== null) {
169 168
 			$result['cached'] = $cachingMetadataArray;
170 169
 		}
171 170
 
Please login to merge, or discard this patch.