Conditions | 1 |
Paths | 1 |
Total Lines | 70 |
Code Lines | 40 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
136 | public function testMarshallingElementOrdering(): void |
||
137 | { |
||
138 | $kaNonce = new KANonce('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='); |
||
139 | |||
140 | $someChunk = new Chunk(DOMDocumentFactory::fromString( |
||
141 | '<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>', |
||
142 | )->documentElement); |
||
143 | |||
144 | $originatorKeyInfo = new OriginatorKeyInfo( |
||
145 | [ |
||
146 | new KeyName('testkey'), |
||
147 | new X509Data( |
||
148 | [ |
||
149 | new X509Certificate(self::$certificate), |
||
150 | new X509SubjectName(self::$certData['name']), |
||
151 | ], |
||
152 | ), |
||
153 | new Chunk(DOMDocumentFactory::fromString( |
||
154 | '<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">originator</ssp:Chunk>', |
||
155 | )->documentElement), |
||
156 | ], |
||
157 | 'fed321', |
||
158 | ); |
||
159 | |||
160 | $recipientKeyInfo = new RecipientKeyInfo( |
||
161 | [ |
||
162 | new KeyName('testkey'), |
||
163 | new X509Data( |
||
164 | [ |
||
165 | new X509Certificate(self::$certificate), |
||
166 | new X509SubjectName(self::$certData['name']), |
||
167 | ], |
||
168 | ), |
||
169 | new Chunk(DOMDocumentFactory::fromString( |
||
170 | '<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">recipient</ssp:Chunk>', |
||
171 | )->documentElement), |
||
172 | ], |
||
173 | 'fed654', |
||
174 | ); |
||
175 | |||
176 | $agreementMethod = new AgreementMethod( |
||
177 | C::XMLENC11_ECDH_ES, |
||
178 | $kaNonce, |
||
179 | $originatorKeyInfo, |
||
180 | $recipientKeyInfo, |
||
181 | [$someChunk], |
||
182 | ); |
||
183 | |||
184 | // Marshall it to a \DOMElement |
||
185 | $agreementMethodElement = $agreementMethod->toXML(); |
||
186 | |||
187 | $xpCache = XPath::getXPath($agreementMethodElement); |
||
188 | |||
189 | // Test for an KA-Nonce |
||
190 | /** @var \DOMElement[] $kaNonceElements */ |
||
191 | $kaNonceElements = XPath::xpQuery($agreementMethodElement, './xenc:KA-Nonce', $xpCache); |
||
192 | $this->assertCount(1, $kaNonceElements); |
||
193 | |||
194 | // Test ordering of AgreementMethod contents |
||
195 | /** @var \DOMElement[] $agreementMethodElements */ |
||
196 | $agreementMethodElements = XPath::xpQuery( |
||
197 | $agreementMethodElement, |
||
198 | './xenc:KA-Nonce/following-sibling::*', |
||
199 | $xpCache, |
||
200 | ); |
||
201 | |||
202 | $this->assertCount(3, $agreementMethodElements); |
||
203 | $this->assertEquals('ssp:Chunk', $agreementMethodElements[0]->tagName); |
||
204 | $this->assertEquals('xenc:OriginatorKeyInfo', $agreementMethodElements[1]->tagName); |
||
205 | $this->assertEquals('xenc:RecipientKeyInfo', $agreementMethodElements[2]->tagName); |
||
206 | } |
||
208 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths