Skip to content

Commit 5fab400

Browse files
author
Greg Bowler
committed
ci: improve quality tests
1 parent 1c3c3c3 commit 5fab400

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

phpmd.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
<rule ref="rulesets/naming.xml/ShortVariable">
3434
<properties>
35-
<property name="exceptions" value="a,b,i" />
35+
<property name="exceptions" value="a,b,i,id" />
3636
</properties>
3737
</rule>
3838
</ruleset>

src/AuthenticatedRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(
3434
foreach($kvp as $key => $value) {
3535
$uri = str_replace(
3636
"{" . $key . "}",
37-
$value ?? "",
37+
$value,
3838
$uri,
3939
);
4040
}

src/Client.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,13 @@ private function json(AuthenticatedRequest $authenticatedRequest):?JsonObject {
7070
"headers" => $httpHeaders,
7171
]);
7272
if(!$response->ok) {
73-
throw new SpektrixAPIException($response->status);
73+
if($response->status === 404) {
74+
return null;
75+
}
76+
77+
throw new SpektrixAPIException("HTTP $response->status");
7478
}
79+
7580
return $response->awaitJson();
7681
}
7782

src/Signature.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,16 @@ public function __construct(
2323
}
2424

2525
$decodedSecretKey = base64_decode($secretKeyBase64);
26-
$utf8encodedStringToSign = mb_convert_encoding($stringToSign, 'UTF-8', 'ISO-8859-1');
27-
$this->signedString = hash_hmac("sha1", $utf8encodedStringToSign, $decodedSecretKey, true);
26+
$utf8encodedStringToSign = mb_convert_encoding(
27+
$stringToSign,
28+
"UTF-8",
29+
"ISO-8859-1",
30+
);
31+
$this->signedString = hash_hmac(
32+
"sha1",
33+
$utf8encodedStringToSign,
34+
$decodedSecretKey,
35+
true,
36+
);
2837
}
2938
}

0 commit comments

Comments
 (0)