UploadedFileFactory::createUploadedFile()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 5
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Furious\Psr7\Factory;
6
7
use Furious\Psr7\UploadedFile;
8
use Psr\Http\Message\StreamInterface;
9
use Psr\Http\Message\UploadedFileFactoryInterface;
10
use Psr\Http\Message\UploadedFileInterface;
11
use const UPLOAD_ERR_OK;
12
13
class UploadedFileFactory implements UploadedFileFactoryInterface
14
{
15
    public function createUploadedFile(
16
        StreamInterface $stream, ?int $size = null, int $error = UPLOAD_ERR_OK,
17
        string $clientFilename = null, string $clientMediaType = null
18
    ): UploadedFileInterface
19
    {
20
        return new UploadedFile(
21
            $stream, $size ?? $stream->getSize(), $error,
22
            $clientFilename, $clientMediaType
23
        );
24
    }
25
}