@@ -73,44 +73,43 @@ discard block |
||
73 | 73 | ) { |
74 | 74 | $response = []; |
75 | 75 | $metadatas = []; |
76 | - foreach ( $entityIds as $entityId ) { |
|
76 | + foreach ($entityIds as $entityId) { |
|
77 | 77 | $results = $this->delegatingConstraintChecker->checkAgainstConstraintsOnEntityId( |
78 | 78 | $entityId, |
79 | 79 | $constraintIds, |
80 | - [ $this, 'defaultResults' ] |
|
80 | + [$this, 'defaultResults'] |
|
81 | 81 | ); |
82 | - foreach ( $results as $result ) { |
|
82 | + foreach ($results as $result) { |
|
83 | 83 | $metadatas[] = $result->getMetadata(); |
84 | - $resultArray = $this->checkResultToArray( $result ); |
|
85 | - $result->getContext()->storeCheckResultInArray( $resultArray, $response ); |
|
84 | + $resultArray = $this->checkResultToArray($result); |
|
85 | + $result->getContext()->storeCheckResultInArray($resultArray, $response); |
|
86 | 86 | } |
87 | 87 | } |
88 | - foreach ( $claimIds as $claimId ) { |
|
88 | + foreach ($claimIds as $claimId) { |
|
89 | 89 | $results = $this->delegatingConstraintChecker->checkAgainstConstraintsOnClaimId( |
90 | 90 | $claimId, |
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 | - $resultArray = $this->checkResultToArray( $result ); |
|
97 | - $result->getContext()->storeCheckResultInArray( $resultArray, $response ); |
|
96 | + $resultArray = $this->checkResultToArray($result); |
|
97 | + $result->getContext()->storeCheckResultInArray($resultArray, $response); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | return new CachedCheckConstraintsResponse( |
101 | 101 | $response, |
102 | - Metadata::merge( $metadatas ) |
|
102 | + Metadata::merge($metadatas) |
|
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
106 | - public function defaultResults( Context $context ) { |
|
106 | + public function defaultResults(Context $context) { |
|
107 | 107 | return $context->getType() === Context::TYPE_STATEMENT ? |
108 | - [ new NullResult( $context ) ] : |
|
109 | - []; |
|
108 | + [new NullResult($context)] : []; |
|
110 | 109 | } |
111 | 110 | |
112 | - public function checkResultToArray( CheckResult $checkResult ) { |
|
113 | - if ( $checkResult instanceof NullResult ) { |
|
111 | + public function checkResultToArray(CheckResult $checkResult) { |
|
112 | + if ($checkResult instanceof NullResult) { |
|
114 | 113 | return null; |
115 | 114 | } |
116 | 115 | |
@@ -118,10 +117,10 @@ discard block |
||
118 | 117 | $typeItemId = $checkResult->getConstraint()->getConstraintTypeItemId(); |
119 | 118 | $constraintPropertyId = $checkResult->getContext()->getSnak()->getPropertyId(); |
120 | 119 | |
121 | - $title = $this->entityTitleLookup->getTitleForId( $constraintPropertyId ); |
|
122 | - $typeLabel = $this->entityIdLabelFormatter->formatEntityId( new ItemId( $typeItemId ) ); |
|
120 | + $title = $this->entityTitleLookup->getTitleForId($constraintPropertyId); |
|
121 | + $typeLabel = $this->entityIdLabelFormatter->formatEntityId(new ItemId($typeItemId)); |
|
123 | 122 | // TODO link to the statement when possible (T169224) |
124 | - $link = $title->getFullURL() . '#' . $this->config->get( 'WBQualityConstraintsPropertyConstraintId' ); |
|
123 | + $link = $title->getFullURL().'#'.$this->config->get('WBQualityConstraintsPropertyConstraintId'); |
|
125 | 124 | |
126 | 125 | $constraint = [ |
127 | 126 | 'id' => $constraintId, |
@@ -130,11 +129,11 @@ discard block |
||
130 | 129 | 'link' => $link, |
131 | 130 | 'discussLink' => $title->getTalkPage()->getFullURL(), |
132 | 131 | ]; |
133 | - if ( $this->config->get( 'WBQualityConstraintsIncludeDetailInApi' ) ) { |
|
132 | + if ($this->config->get('WBQualityConstraintsIncludeDetailInApi')) { |
|
134 | 133 | $parameters = $checkResult->getParameters(); |
135 | 134 | $constraint += [ |
136 | 135 | 'detail' => $parameters, |
137 | - 'detailHTML' => $this->constraintParameterRenderer->formatParameters( $parameters ), |
|
136 | + 'detailHTML' => $this->constraintParameterRenderer->formatParameters($parameters), |
|
138 | 137 | ]; |
139 | 138 | } |
140 | 139 | |
@@ -144,14 +143,14 @@ discard block |
||
144 | 143 | 'constraint' => $constraint |
145 | 144 | ]; |
146 | 145 | $message = $checkResult->getMessage(); |
147 | - if ( $message ) { |
|
146 | + if ($message) { |
|
148 | 147 | $result['message-html'] = $message; |
149 | 148 | } |
150 | - if ( $checkResult->getContext()->getType() === Context::TYPE_STATEMENT ) { |
|
149 | + if ($checkResult->getContext()->getType() === Context::TYPE_STATEMENT) { |
|
151 | 150 | $result['claim'] = $checkResult->getContext()->getSnakStatement()->getGuid(); |
152 | 151 | } |
153 | 152 | $cachingMetadataArray = $checkResult->getMetadata()->getCachingMetadata()->toArray(); |
154 | - if ( $cachingMetadataArray !== null ) { |
|
153 | + if ($cachingMetadataArray !== null) { |
|
155 | 154 | $result['cached'] = $cachingMetadataArray; |
156 | 155 | } |
157 | 156 |