| Conditions | 1 |
| Paths | 1 |
| Total Lines | 75 |
| Code Lines | 42 |
| 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 |
||
| 144 | public function testMarshallingElementOrdering(): void |
||
| 145 | { |
||
| 146 | $kaNonce = new KANonce('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='); |
||
| 147 | |||
| 148 | $digestMethod = new DigestMethod( |
||
| 149 | C::DIGEST_SHA256, |
||
| 150 | [ |
||
| 151 | new Chunk(DOMDocumentFactory::fromString( |
||
| 152 | '<some:Chunk xmlns:some="urn:x-simplesamlphp:namespace">some</some:Chunk>', |
||
| 153 | )->documentElement), |
||
| 154 | ], |
||
| 155 | ); |
||
| 156 | |||
| 157 | $originatorKeyInfo = new OriginatorKeyInfo( |
||
| 158 | [ |
||
| 159 | new KeyName('testkey'), |
||
| 160 | new X509Data( |
||
| 161 | [ |
||
| 162 | new X509Certificate(self::$certificate), |
||
| 163 | new X509SubjectName(self::$certData['name']), |
||
| 164 | ], |
||
| 165 | ), |
||
| 166 | new Chunk(DOMDocumentFactory::fromString( |
||
| 167 | '<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">originator</ssp:Chunk>', |
||
| 168 | )->documentElement), |
||
| 169 | ], |
||
| 170 | 'fed321', |
||
| 171 | ); |
||
| 172 | |||
| 173 | $recipientKeyInfo = new RecipientKeyInfo( |
||
| 174 | [ |
||
| 175 | new KeyName('testkey'), |
||
| 176 | new X509Data( |
||
| 177 | [ |
||
| 178 | new X509Certificate(self::$certificate), |
||
| 179 | new X509SubjectName(self::$certData['name']), |
||
| 180 | ], |
||
| 181 | ), |
||
| 182 | new Chunk(DOMDocumentFactory::fromString( |
||
| 183 | '<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">recipient</ssp:Chunk>', |
||
| 184 | )->documentElement), |
||
| 185 | ], |
||
| 186 | 'fed654', |
||
| 187 | ); |
||
| 188 | |||
| 189 | $agreementMethod = new AgreementMethod( |
||
| 190 | C::XMLENC11_ECDH_ES, |
||
| 191 | $kaNonce, |
||
| 192 | $originatorKeyInfo, |
||
| 193 | $recipientKeyInfo, |
||
| 194 | [$digestMethod], |
||
| 195 | ); |
||
| 196 | |||
| 197 | // Marshall it to a \DOMElement |
||
| 198 | $agreementMethodElement = $agreementMethod->toXML(); |
||
| 199 | |||
| 200 | $xpCache = XPath::getXPath($agreementMethodElement); |
||
| 201 | |||
| 202 | // Test for an KA-Nonce |
||
| 203 | /** @var \DOMElement[] $kaNonceElements */ |
||
| 204 | $kaNonceElements = XPath::xpQuery($agreementMethodElement, './xenc:KA-Nonce', $xpCache); |
||
| 205 | $this->assertCount(1, $kaNonceElements); |
||
| 206 | |||
| 207 | // Test ordering of AgreementMethod contents |
||
| 208 | /** @var \DOMElement[] $agreementMethodElements */ |
||
| 209 | $agreementMethodElements = XPath::xpQuery( |
||
| 210 | $agreementMethodElement, |
||
| 211 | './xenc:KA-Nonce/following-sibling::*', |
||
| 212 | $xpCache, |
||
| 213 | ); |
||
| 214 | |||
| 215 | $this->assertCount(3, $agreementMethodElements); |
||
| 216 | $this->assertEquals('ds:DigestMethod', $agreementMethodElements[0]->tagName); |
||
| 217 | $this->assertEquals('xenc:OriginatorKeyInfo', $agreementMethodElements[1]->tagName); |
||
| 218 | $this->assertEquals('xenc:RecipientKeyInfo', $agreementMethodElements[2]->tagName); |
||
| 219 | } |
||
| 221 |
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