Linked build status badge to builds page

This commit is contained in:
Barnaby Walters 2021-06-16 15:58:28 +02:00
parent 6b3c56fb6e
commit bb22f9b0e3
2 changed files with 9 additions and 6 deletions

View File

@ -247,7 +247,7 @@ class Server {
$httpGetWithEffectiveUrl = $config['httpGetWithEffectiveUrl']; $httpGetWithEffectiveUrl = $config['httpGetWithEffectiveUrl'];
if (is_null($httpGetWithEffectiveUrl)) { if (is_null($httpGetWithEffectiveUrl)) {
if (class_exists('\GuzzleHttp\Client')) { if (class_exists('\GuzzleHttp\Client')) {
$httpGetWithEffectiveUrl = function (string $uri) { $httpGetWithEffectiveUrl = function (string $uri): array {
// This code cant be tested, ignore it for coverage purposes. // This code cant be tested, ignore it for coverage purposes.
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
$resp = (new \GuzzleHttp\Client([ $resp = (new \GuzzleHttp\Client([

View File

@ -8,7 +8,7 @@ use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
// From https://github.com/indieweb/indieauth-client-php/blob/main/src/IndieAuth/Client.php, thanks aaronpk. // From https://github.com/indieweb/indieauth-client-php/blob/main/src/IndieAuth/Client.php, thanks aaronpk.
function generateRandomString($numBytes) { function generateRandomString(int $numBytes): string {
if (function_exists('random_bytes')) { if (function_exists('random_bytes')) {
$bytes = random_bytes($numBytes); $bytes = random_bytes($numBytes);
// We cant easily test the following code. // We cant easily test the following code.
@ -25,7 +25,7 @@ function generateRandomString($numBytes) {
return bin2hex($bytes); return bin2hex($bytes);
} }
function generateRandomPrintableAsciiString(int $length) { function generateRandomPrintableAsciiString(int $length): string {
$chars = []; $chars = [];
while (count($chars) < $length) { while (count($chars) < $length) {
// 0x21 to 0x7E is the entire printable ASCII range, not including space (0x20). // 0x21 to 0x7E is the entire printable ASCII range, not including space (0x20).
@ -34,7 +34,7 @@ function generateRandomPrintableAsciiString(int $length) {
return join('', $chars); return join('', $chars);
} }
function generatePKCECodeChallenge($plaintext) { function generatePKCECodeChallenge(string $plaintext): string {
return base64_urlencode(hash('sha256', $plaintext, true)); return base64_urlencode(hash('sha256', $plaintext, true));
} }
@ -65,7 +65,7 @@ function isIndieAuthAuthorizationCodeRedeemingRequest(ServerRequestInterface $re
function isIndieAuthAuthorizationRequest(ServerRequestInterface $request, array $permittedMethods=['get']): bool { function isIndieAuthAuthorizationRequest(ServerRequestInterface $request, array $permittedMethods=['get']): bool {
return in_array(strtolower($request->getMethod()), array_map('strtolower', $permittedMethods)) return in_array(strtolower($request->getMethod()), array_map('strtolower', $permittedMethods))
&& array_key_exists('response_type', $request->getQueryParams() ?? []) && array_key_exists('response_type', $request->getQueryParams())
&& $request->getQueryParams()['response_type'] == 'code'; && $request->getQueryParams()['response_type'] == 'code';
} }
@ -107,7 +107,7 @@ function urlComponentsMatch(string $url1, string $url2, ?array $components=null)
* existing query string. Then appends the newly generated query string * existing query string. Then appends the newly generated query string
* with either ? or & as appropriate. * with either ? or & as appropriate.
*/ */
function appendQueryParams(string $uri, array $queryParams) { function appendQueryParams(string $uri, array $queryParams): string {
if (empty($queryParams)) { if (empty($queryParams)) {
return $uri; return $uri;
} }
@ -123,6 +123,9 @@ function appendQueryParams(string $uri, array $queryParams) {
* *
* If `$target` implements `LoggerAwareInterface`, set its logger * If `$target` implements `LoggerAwareInterface`, set its logger
* to `$logger`. Returns `$target`. * to `$logger`. Returns `$target`.
*
* @psalm-suppress MissingReturnType
* @psalm-suppress MissingParamType
*/ */
function trySetLogger($target, LoggerInterface $logger) { function trySetLogger($target, LoggerInterface $logger) {
if ($target instanceof LoggerAwareInterface) { if ($target instanceof LoggerAwareInterface) {