Update Composer packages

This commit is contained in:
Paul Nicoué 2022-12-19 14:56:05 +01:00
parent 0320235f6c
commit a8b68fb61b
378 changed files with 28466 additions and 28852 deletions

View file

@ -3,6 +3,7 @@
namespace Kirby\Cms;
use Kirby\Filesystem\F;
use Kirby\Filesystem\Mime;
use Kirby\Toolkit\Str;
/**
@ -81,7 +82,10 @@ class FileBlueprint extends Blueprint
if (is_array($accept['extension']) === true) {
// determine the main MIME type for each extension
$restrictions[] = array_map(['Kirby\Filesystem\Mime', 'fromExtension'], $accept['extension']);
$restrictions[] = array_map(
[Mime::class, 'fromExtension'],
$accept['extension']
);
}
if (is_array($accept['type']) === true) {
@ -89,7 +93,10 @@ class FileBlueprint extends Blueprint
$mimes = [];
foreach ($accept['type'] as $type) {
if ($extensions = F::typeToExtensions($type)) {
$mimes[] = array_map(['Kirby\Filesystem\Mime', 'fromExtension'], $extensions);
$mimes[] = array_map(
[Mime::class, 'fromExtension'],
$extensions
);
}
}
@ -119,19 +126,15 @@ class FileBlueprint extends Blueprint
*/
protected function normalizeAccept($accept = null): array
{
if (is_string($accept) === true) {
$accept = [
'mime' => $accept
];
} elseif ($accept === true) {
$accept = match (true) {
is_string($accept) => ['mime' => $accept],
// explicitly no restrictions at all
$accept = [
'mime' => null
];
} elseif (empty($accept) === true) {
$accept === true => ['mime' => null],
// no custom restrictions
$accept = [];
}
empty($accept) === true => [],
// custom restrictions
default => $accept
};
$accept = array_change_key_case($accept);