Skip to content

Commit 77084b8

Browse files
committed
Fix codesniffer issues
1 parent 9674d77 commit 77084b8

8 files changed

Lines changed: 123 additions & 125 deletions

File tree

src/Utils/Certificate.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,3 @@ public static function convertToCertificate(string $X509CertificateContents): st
3737
. "-----END CERTIFICATE-----";
3838
}
3939
}
40-

src/Utils/XPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static function findElement(DOMNode $ref, $name)
4949
throw new RuntimeException('Cannot search, no DOM document available');
5050
}
5151

52-
$nodeset = self::getXPath($doc)->query('./'.$name, $ref);
52+
$nodeset = self::getXPath($doc)->query('./' . $name, $ref);
5353

5454
if ($nodeset->length === 0) {
5555
return false;

tests/Alg/HMACSignatureTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function testSign()
7272
// test HMAC-SHA512
7373
$hmac = $this->factory->getAlgorithm(Constants::SIG_HMAC_SHA512, $key);
7474
$this->assertEquals(
75-
'9cc73c95f564a142b28340cf6e1d6b509a9e97dab6577e5d0199760a858105185252e203b6b096ad24708a2b7e34a0f506776d88e'.
75+
'9cc73c95f564a142b28340cf6e1d6b509a9e97dab6577e5d0199760a858105185252e203b6b096ad24708a2b7e34a0f506776d88e' .
7676
'2f47fff055fc51342b69cdc',
7777
bin2hex($hmac->sign($this->plaintext))
7878
);
@@ -120,7 +120,7 @@ public function testVerify()
120120
$this->assertTrue($hmac->verify(
121121
$this->plaintext,
122122
hex2bin(
123-
'9cc73c95f564a142b28340cf6e1d6b509a9e97dab6577e5d0199760a858105185252e203b6b096ad24708a2b7e34a0f5067'.
123+
'9cc73c95f564a142b28340cf6e1d6b509a9e97dab6577e5d0199760a858105185252e203b6b096ad24708a2b7e34a0f5067' .
124124
'76d88e2f47fff055fc51342b69cdc'
125125
)
126126
));
@@ -140,7 +140,7 @@ public function testVerificationFailure()
140140

141141
// test wrong plaintext
142142
$hmac = $this->factory->getAlgorithm(Constants::SIG_HMAC_SHA1, $key);
143-
$this->assertFalse($hmac->verify($this->plaintext.'.', hex2bin('655c3b4277b39f31dedf5adc7f4cc9f07da7102c')));
143+
$this->assertFalse($hmac->verify($this->plaintext . '.', hex2bin('655c3b4277b39f31dedf5adc7f4cc9f07da7102c')));
144144

145145
// test wrong signature
146146
$this->assertFalse($hmac->verify($this->plaintext, hex2bin('655c3b4277b39f31dedf5adc7f4cc9f07da7102d')));

tests/Alg/RSASignatureTest.php

Lines changed: 74 additions & 74 deletions
Large diffs are not rendered by default.

tests/Backend/OpenSSLTest.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ protected function setUp(): void
4444
$this->backend->setDigestAlg(Constants::DIGEST_SHA256);
4545
$this->backend->setCipher(Constants::BLOCK_ENC_AES256_GCM);
4646
$this->validSig =
47-
'cdd80e925e509f954807448217157367c00f7ff53c5eec74ea51ef5fee48a048283b37639c7f43400631fa2b9063a1ed05710'.
48-
'4721887a10ad62f128c26e01f363538a84ad261f40b80df86de9cc920d1dce2c27058da81d9c7aa0e68e459ab94995e27e57d'.
49-
'183ff08188b338f7975681ad67b1b6f8d174b57b666f787b801df9511d7a90e90e9af2386f4051669a4763ce5e9720fc8ae2b'.
50-
'c90e7c33d92a4bcecefddb06599b1f3adf48cde42d442d76c4d938d1570379bf1ab45feae95f94f48a460a8894f90e0208ba9'.
51-
'3d86b505f32942f53bdab8e506ba227cc813cd26a0ba9a93c46f27dd0c2b7452fd8c79c7aa72b885d95ef6d1dc810829b0832'.
47+
'cdd80e925e509f954807448217157367c00f7ff53c5eec74ea51ef5fee48a048283b37639c7f43400631fa2b9063a1ed05710' .
48+
'4721887a10ad62f128c26e01f363538a84ad261f40b80df86de9cc920d1dce2c27058da81d9c7aa0e68e459ab94995e27e57d' .
49+
'183ff08188b338f7975681ad67b1b6f8d174b57b666f787b801df9511d7a90e90e9af2386f4051669a4763ce5e9720fc8ae2b' .
50+
'c90e7c33d92a4bcecefddb06599b1f3adf48cde42d442d76c4d938d1570379bf1ab45feae95f94f48a460a8894f90e0208ba9' .
51+
'3d86b505f32942f53bdab8e506ba227cc813cd26a0ba9a93c46f27dd0c2b7452fd8c79c7aa72b885d95ef6d1dc810829b0832' .
5252
'abe290d';
5353
}
5454

@@ -128,11 +128,11 @@ public function testDecrypt()
128128
$this->backend->decrypt(
129129
$this->privKey,
130130
hex2bin(
131-
'c2aa74a85de59daef76c4f4736680ff55503d1ce991a6b947ad5d269b93ef97acf761c1c1ccfedc1382d2c16ea52b7f6b'.
132-
'298d8a0f6dbf5e46c41df70804888758e2b95502d9b0849c8d670e4bb9f13bb9afa1d51a76a32625513599c4a2d841cb7'.
133-
'9beec171b9c0cf11466e90187e91377a7f7582f3eec3df6703a1abda89339d0f490bca61ceac743be401d861d50eb6aaa'.
134-
'2db63264cd2013e4008d82c4e7b3f8f13447cf136e52c9b9f06c062a3fe66d3b9f7fa78281d149e7756a97edb0b2a500f'.
135-
'110587f2d81790922def9061c4d8d500cd67ade406b61a20a8fe3b7db1ccc69095a20f556e5ed1f91ccaff1cb3f13065e'.
131+
'c2aa74a85de59daef76c4f4736680ff55503d1ce991a6b947ad5d269b93ef97acf761c1c1ccfedc1382d2c16ea52b7f6b' .
132+
'298d8a0f6dbf5e46c41df70804888758e2b95502d9b0849c8d670e4bb9f13bb9afa1d51a76a32625513599c4a2d841cb7' .
133+
'9beec171b9c0cf11466e90187e91377a7f7582f3eec3df6703a1abda89339d0f490bca61ceac743be401d861d50eb6aaa' .
134+
'2db63264cd2013e4008d82c4e7b3f8f13447cf136e52c9b9f06c062a3fe66d3b9f7fa78281d149e7756a97edb0b2a500f' .
135+
'110587f2d81790922def9061c4d8d500cd67ade406b61a20a8fe3b7db1ccc69095a20f556e5ed1f91ccaff1cb3f13065e' .
136136
'bee9e20064b0a75edb2b603af6c'
137137
)
138138
)
@@ -144,11 +144,11 @@ public function testDecrypt()
144144
$this->backend->decrypt(
145145
$this->pubKey,
146146
hex2bin(
147-
'd012f638b7814f63cce16d1938d34e1f82abcbe925cf579a4dd6e5b0d8f0c524b77a94423625c1cec7cc45e26f37188ff'.
148-
'18870cd4f8cd3e0de6084413c71c1f4f14f04858a655162e9332f4b26fe4523cebf7de51267290f8ae290c869fb324570'.
149-
'd9065b9604587111b116e8d15d8ef820f2ea2c1ae129ce27a20c4a7e4df815fb47a047cd11b06ada9f4ad8815452380a0'.
150-
'9fb6bff787ff167a20662740e1ac034e66612e2194d8b60a22341032d758fd94221314125dbb2d1432b4a3633b0857d8d'.
151-
'4938aabe1b53ab5f970fb4ad0ed0a554771cfa819cffba8ec5935a6d2f706dfcada355da34b994691c76a60d10c746a5b'.
147+
'd012f638b7814f63cce16d1938d34e1f82abcbe925cf579a4dd6e5b0d8f0c524b77a94423625c1cec7cc45e26f37188ff' .
148+
'18870cd4f8cd3e0de6084413c71c1f4f14f04858a655162e9332f4b26fe4523cebf7de51267290f8ae290c869fb324570' .
149+
'd9065b9604587111b116e8d15d8ef820f2ea2c1ae129ce27a20c4a7e4df815fb47a047cd11b06ada9f4ad8815452380a0' .
150+
'9fb6bff787ff167a20662740e1ac034e66612e2194d8b60a22341032d758fd94221314125dbb2d1432b4a3633b0857d8d' .
151+
'4938aabe1b53ab5f970fb4ad0ed0a554771cfa819cffba8ec5935a6d2f706dfcada355da34b994691c76a60d10c746a5b' .
152152
'683b2a0080d847ff208cf240a1c'
153153
)
154154
)

tests/SignatureTest.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,15 @@ public function testSignatureWithNoPrefix()
208208
public function testSignatureWithComments()
209209
{
210210
$doc = DOMDocumentFactory::fromString(
211-
'<ApplicationRequest xmlns:pfx="http://example.org/xmldata/" Id="SomeID">'.
212-
'<!-- this is a comment -->'.
213-
'<CustomerId>12345678</CustomerId>'.
214-
'<Command>GetUserInfo</Command>'.
215-
'<Timestamp>1317032524</Timestamp>'.
216-
'<Status>ALL</Status>'.
217-
'<Environment>DEVELOPMENT</Environment>'.
218-
'<SoftwareId>ExampleApp 0.1\b</SoftwareId>'.
219-
'<FileType>ABCDEFG</FileType>'.
211+
'<ApplicationRequest xmlns:pfx="http://example.org/xmldata/" Id="SomeID">' .
212+
'<!-- this is a comment -->' .
213+
'<CustomerId>12345678</CustomerId>' .
214+
'<Command>GetUserInfo</Command>' .
215+
'<Timestamp>1317032524</Timestamp>' .
216+
'<Status>ALL</Status>' .
217+
'<Environment>DEVELOPMENT</Environment>' .
218+
'<SoftwareId>ExampleApp 0.1\b</SoftwareId>' .
219+
'<FileType>ABCDEFG</FileType>' .
220220
'</ApplicationRequest>'
221221
);
222222
$signature = new Signature($doc->documentElement);
@@ -282,15 +282,15 @@ public function testAutomaticallyAddingReferencesWithComments()
282282
public function testSignatureWithRegeneratedId()
283283
{
284284
$doc = DOMDocumentFactory::fromString(
285-
'<ApplicationRequest xmlns="http://example.org/xmldata/" ID="SomeID">'.
286-
'<!-- this is a comment -->'.
287-
'<CustomerId>12345678</CustomerId>'.
288-
'<Command>GetUserInfo</Command>'.
289-
'<Timestamp>1317032524</Timestamp>'.
290-
'<Status>ALL</Status>'.
291-
'<Environment>DEVELOPMENT</Environment>'.
292-
'<SoftwareId>ExampleApp 0.1\b</SoftwareId>'.
293-
'<FileType>ABCDEFG</FileType>'.
285+
'<ApplicationRequest xmlns="http://example.org/xmldata/" ID="SomeID">' .
286+
'<!-- this is a comment -->' .
287+
'<CustomerId>12345678</CustomerId>' .
288+
'<Command>GetUserInfo</Command>' .
289+
'<Timestamp>1317032524</Timestamp>' .
290+
'<Status>ALL</Status>' .
291+
'<Environment>DEVELOPMENT</Environment>' .
292+
'<SoftwareId>ExampleApp 0.1\b</SoftwareId>' .
293+
'<FileType>ABCDEFG</FileType>' .
294294
'</ApplicationRequest>'
295295
);
296296
$signature = new Signature($doc->documentElement);
@@ -450,14 +450,14 @@ public function testReferenceWithCommentsRemovedWhenObjectID()
450450
public function testEnvelopingSignature()
451451
{
452452
$doc = DOMDocumentFactory::fromString(
453-
'<root Id="SomeID">'.
454-
'<!-- This comment should not be included in the digest. -->'.
455-
'<!-- withcomment-id-uri ds:signature tag -->'.
456-
'<!-- Neither should this comment be included. -->'.
457-
'<childnode>'.
458-
'sometext'.
459-
'<!-- Nor this comment. -->'.
460-
'</childnode>'.
453+
'<root Id="SomeID">' .
454+
'<!-- This comment should not be included in the digest. -->' .
455+
'<!-- withcomment-id-uri ds:signature tag -->' .
456+
'<!-- Neither should this comment be included. -->' .
457+
'<childnode>' .
458+
'sometext' .
459+
'<!-- Nor this comment. -->' .
460+
'</childnode>' .
461461
'</root>'
462462
);
463463
$signature = new Signature($doc->documentElement);
@@ -615,8 +615,8 @@ public function testVerifiedNode()
615615
public function testForCommentsInContents()
616616
{
617617
$doc = DOMDocumentFactory::fromString(
618-
'<ApplicationRequest xmlns="http://example.org/xmldata/" Id="SomeID">'.
619-
'<CustomerId>12345678<!--0-->9</CustomerId>'.
618+
'<ApplicationRequest xmlns="http://example.org/xmldata/" Id="SomeID">' .
619+
'<CustomerId>12345678<!--0-->9</CustomerId>' .
620620
'</ApplicationRequest>'
621621
);
622622
$signature = new Signature($doc->documentElement);

tests/Utils/CertificateTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,3 @@ public function testConvertToCertificate(): void
4141
$this->assertEquals(trim(PEMCertificatesMock::getPlainPublicKey()), $result);
4242
}
4343
}
44-

tests/Utils/RandomTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ public function testGenerateGUID()
2121
$mainRegEx = '[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}';
2222

2323
// test with default prefix
24-
$this->assertMatchesRegularExpression('/_'.$mainRegEx.'/', Random::generateGUID());
24+
$this->assertMatchesRegularExpression('/_' . $mainRegEx . '/', Random::generateGUID());
2525

2626
// test with different prefix
27-
$this->assertMatchesRegularExpression('/pfx'.$mainRegEx.'/', Random::generateGUID('pfx'));
27+
$this->assertMatchesRegularExpression('/pfx' . $mainRegEx . '/', Random::generateGUID('pfx'));
2828
}
2929
}

0 commit comments

Comments
 (0)