UploadedFileFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 14
ccs 3
cts 3
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A createUploadedFile() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace HttpSoft\Message;
6
7
use Psr\Http\Message\StreamInterface;
8
use Psr\Http\Message\UploadedFileFactoryInterface;
9
use Psr\Http\Message\UploadedFileInterface;
10
11
use const UPLOAD_ERR_OK;
12
13
final class UploadedFileFactory implements UploadedFileFactoryInterface
14
{
15
    /**
16
     * {@inheritDoc}
17
     */
18 2
    public function createUploadedFile(
19
        StreamInterface $stream,
20
        int $size = null,
21
        int $error = UPLOAD_ERR_OK,
22
        string $clientFilename = null,
23
        string $clientMediaType = null
24
    ): UploadedFileInterface {
25 2
        $size = (int) ($size === null ? $stream->getSize() : $size);
26 2
        return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType);
27
    }
28
}
29