Total Complexity | 3 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class UploadedFile extends BaseUploadedFile |
||
16 | { |
||
17 | /** |
||
18 | * @var \Zapheus\Http\Message\FileInterface |
||
19 | */ |
||
20 | protected $file; |
||
21 | |||
22 | /** |
||
23 | * Initializes the uploaded file instance. |
||
24 | * |
||
25 | * @param \Zapheus\Http\Message\FileInterface $file |
||
26 | */ |
||
27 | 72 | public function __construct(FileInterface $file) |
|
28 | { |
||
29 | 72 | $this->file = $file; |
|
30 | |||
31 | 72 | $this->error = $file->error(); |
|
32 | |||
33 | 72 | $this->name = $file->name(); |
|
34 | |||
35 | 72 | $this->size = $file->size(); |
|
36 | |||
37 | 72 | $this->media = $file->type(); |
|
38 | 72 | } |
|
39 | |||
40 | /** |
||
41 | * Retrieve a stream representing the uploaded file. |
||
42 | * |
||
43 | * @return \Psr\Http\Message\StreamInterface |
||
44 | * |
||
45 | * @throws \RuntimeException |
||
46 | */ |
||
47 | 3 | public function getStream() |
|
48 | { |
||
49 | 3 | return new Stream($this->file->stream()); |
|
50 | } |
||
51 | |||
52 | /** |
||
53 | * Move the uploaded file to a new location. |
||
54 | * |
||
55 | * @param string $target |
||
56 | * |
||
57 | * @throws \InvalidArgumentException |
||
58 | * @throws \RuntimeException |
||
59 | */ |
||
60 | 3 | public function moveTo($target) |
|
63 | 3 | } |
|
64 | } |
||
65 |