UploadedFileFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 18
ccs 7
cts 7
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createUploadedFile() 0 13 1
1
<?php declare(strict_types=1);
2
3
/**
4
 * It's free open-source software released under the MIT License.
5
 *
6
 * @author Anatoly Nekhay <[email protected]>
7
 * @copyright Copyright (c) 2018, Anatoly Nekhay
8
 * @license https://github.com/sunrise-php/http-message/blob/master/LICENSE
9
 * @link https://github.com/sunrise-php/http-message
10
 */
11
12
namespace Sunrise\Http\Message;
13
14
use Psr\Http\Message\StreamInterface;
15
use Psr\Http\Message\UploadedFileFactoryInterface;
16
use Psr\Http\Message\UploadedFileInterface;
17
18
use const UPLOAD_ERR_OK;
19
20
/**
21
 * @psalm-suppress ClassMustBeFinal
22
 */
23
class UploadedFileFactory implements UploadedFileFactoryInterface
24
{
25
    /**
26
     * @inheritDoc
27
     */
28 3
    public function createUploadedFile(
29
        StreamInterface $stream,
30
        ?int $size = null,
31
        int $error = UPLOAD_ERR_OK,
32
        ?string $clientFilename = null,
33
        ?string $clientMediaType = null
34
    ): UploadedFileInterface {
35 3
        return new UploadedFile(
36 3
            $stream,
37 3
            $size,
38 3
            $error,
39 3
            $clientFilename,
40 3
            $clientMediaType
41 3
        );
42
    }
43
}
44