Passed
Pull Request — master (#27)
by Anatoly
04:06
created

UploadedFileFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
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 19
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
/**
15
 * Import classes
16
 */
17
use Psr\Http\Message\StreamInterface;
18
use Psr\Http\Message\UploadedFileFactoryInterface;
19
use Psr\Http\Message\UploadedFileInterface;
20
21
/**
22
 * Import constants
23
 */
24
use const UPLOAD_ERR_OK;
25
26
/**
27
 * UploadedFileFactory
28
 *
29
 * @link https://www.php-fig.org/psr/psr-17/
30
 */
31
class UploadedFileFactory implements UploadedFileFactoryInterface
32
{
33
34
    /**
35
     * {@inheritdoc}
36
     */
37 3
    public function createUploadedFile(
38
        StreamInterface $stream,
39
        ?int $size = null,
40
        int $error = UPLOAD_ERR_OK,
41
        ?string $clientFilename = null,
42
        ?string $clientMediaType = null
43
    ): UploadedFileInterface {
44 3
        return new UploadedFile(
45 3
            $stream,
46 3
            $size,
47 3
            $error,
48 3
            $clientFilename,
49 3
            $clientMediaType
50 3
        );
51
    }
52
}
53