UploadedFileFactory::createUploadedFile()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 5
dl 0
loc 8
rs 10
c 1
b 0
f 0
1
<?php
2
/**
3
 * Class UploadedFileFactory
4
 *
5
 * @created      27.08.2018
6
 * @author       smiley <[email protected]>
7
 * @copyright    2018 smiley
8
 * @license      MIT
9
 */
10
11
namespace chillerlan\HTTP\Psr17;
12
13
use chillerlan\HTTP\Psr7\UploadedFile;
14
use Psr\Http\Message\{StreamInterface, UploadedFileFactoryInterface, UploadedFileInterface};
15
16
use const UPLOAD_ERR_OK;
17
18
class UploadedFileFactory implements UploadedFileFactoryInterface{
19
20
	/**
21
	 * @inheritDoc
22
	 */
23
	public function createUploadedFile(
24
		StreamInterface $stream,
25
		int $size = null,
26
		int $error = UPLOAD_ERR_OK,
27
		string $clientFilename = null,
28
		string $clientMediaType = null
29
	):UploadedFileInterface{
30
		return new UploadedFile($stream, $size ?? (int)$stream->getSize(), $error, $clientFilename, $clientMediaType);
31
	}
32
33
}
34