Passed
Push — gh-pages ( 22b0fe...eb2d91 )
by
unknown
12:27 queued 10:15
created

UploadedFileFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 7
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createUploadedFile() 0 2 1
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
final class UploadedFileFactory implements UploadedFileFactoryInterface{
19
20
	/**
21
	 * @inheritDoc
22
	 */
23
	public function createUploadedFile(StreamInterface $stream, int $size = null, int $error = UPLOAD_ERR_OK, string $clientFilename = null, string $clientMediaType = null):UploadedFileInterface{
24
		return new UploadedFile($stream, $size ?? (int)$stream->getSize(), $error, $clientFilename, $clientMediaType);
25
	}
26
27
}
28