Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
rikmeijer committed Nov 7, 2023
1 parent b784bff commit fce57d1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/UI/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static function negotiateType(callable $directory) {

static function negotiateMethod(callable $typeNegotiator, callable $mapTypes) {
return fn(callable $methodExists) => fn(callable $acceptedTypes, callable $missingIdentifier) => $typeNegotiator($methodExists(
Functional::intersect($acceptedTypes($mapTypes)),
$acceptedTypes($mapTypes),
$missingIdentifier
));
}
Expand Down
4 changes: 2 additions & 2 deletions lib/UI/Web.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ static function error(callable $respond) {
}

static function acceptableTypes(string $acceptHeader) {
return fn(callable $map) => $map(Functional::arsort(array_reduce(explode(',', $acceptHeader), function ($res, $el) {
return fn(callable $map) => Functional::intersect($map(Functional::arsort(array_reduce(explode(',', $acceptHeader), function ($res, $el) {
list($l, $q) = array_merge(explode(';q=', $el), [1]);
$res[$l] = (float) $q;
return $res;
}, [])));
}, []))));
}

static function entry(array $server): callable {
Expand Down

0 comments on commit fce57d1

Please sign in to comment.