Conditions | 1 |
Paths | 1 |
Total Lines | 54 |
Code Lines | 31 |
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 |
||
114 | public function testMarshallingElementOrder(): void |
||
115 | { |
||
116 | $alg = 'http://www.w3.org/2009/xmlenc11#ConcatKDF'; |
||
117 | $keyName = new KeyName('testkey'); |
||
118 | |||
119 | $keyDerivationMethod = new KeyDerivationMethod($alg, [$keyName]); |
||
120 | |||
121 | $transformData = new Transform( |
||
122 | C::XPATH10_URI, |
||
123 | new XPath('self::xenc:EncryptedData[@Id="example1"]'), |
||
124 | ); |
||
125 | $transformKey = new Transform( |
||
126 | C::XPATH10_URI, |
||
127 | new XPath('self::xenc:EncryptedKey[@Id="example1"]'), |
||
128 | ); |
||
129 | |||
130 | $referenceList = new ReferenceList( |
||
131 | [ |
||
132 | new DataReference('#Encrypted_DATA_ID', [new Transforms([$transformData])]), |
||
133 | ], |
||
134 | [ |
||
135 | new KeyReference('#Encrypted_KEY_ID', [new Transforms([$transformKey])]), |
||
136 | ], |
||
137 | ); |
||
138 | |||
139 | $derivedKeyName = new DerivedKeyName('phpunit'); |
||
140 | $masterKeyName = new MasterKeyName('phpunit'); |
||
141 | |||
142 | $derivedKey = new DerivedKey( |
||
143 | 'phpunit', |
||
144 | 'phpunit', |
||
145 | 'urn:x-simplesamlphp:type', |
||
146 | $keyDerivationMethod, |
||
147 | $referenceList, |
||
148 | $derivedKeyName, |
||
149 | $masterKeyName, |
||
150 | ); |
||
151 | |||
152 | $dkElement = $derivedKey->toXML(); |
||
153 | $xpCache = XPathUtils::getXPath($dkElement); |
||
154 | |||
155 | // Test for a KeyDerivationMethod |
||
156 | /** @var \DOMElement[] $keyDerivationMethodElements */ |
||
157 | $keyDerivationMethodElements = XPathUtils::xpQuery($dkElement, './xenc11:KeyDerivationMethod', $xpCache); |
||
158 | $this->assertCount(1, $keyDerivationMethodElements); |
||
159 | |||
160 | // Test ordering of DerivedKey contents |
||
161 | /** @var \DOMElement[] $dkElements */ |
||
162 | $dkElements = XPathUtils::xpQuery($dkElement, './xenc11:KeyDerivationMethod/following-sibling::*', $xpCache); |
||
163 | |||
164 | $this->assertCount(3, $dkElements); |
||
165 | $this->assertEquals('xenc:ReferenceList', $dkElements[0]->tagName); |
||
166 | $this->assertEquals('xenc11:DerivedKeyName', $dkElements[1]->tagName); |
||
167 | $this->assertEquals('xenc11:MasterKeyName', $dkElements[2]->tagName); |
||
168 | } |
||
185 |
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