Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Upload
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Cosray\Config;
6
7/** @psalm-import-type MimeMap from Types */
8final class Upload
9{
10    /** @var MimeMap|null */
11    private ?array $fileCache = null;
12
13    /** @var MimeMap|null */
14    private ?array $imageCache = null;
15
16    /** @var MimeMap|null */
17    private ?array $videoCache = null;
18
19    public function __construct(
20        private readonly \Cosray\Config $config,
21    ) {}
22
23    /** @var MimeMap */
24    public array $file {
25        get => $this->fileCache ??= $this->config->get('upload.mimetypes.file');
26    }
27
28    /** @var MimeMap */
29    public array $image {
30        get => $this->imageCache ??= $this->config->get('upload.mimetypes.image');
31    }
32
33    /** @var MimeMap */
34    public array $video {
35        get => $this->videoCache ??= $this->config->get('upload.mimetypes.video');
36    }
37
38    /** @var positive-int */
39    public int $maxSize {
40        get => $this->config->get('upload.maxsize');
41    }
42}