Total Complexity | 3 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 0% |
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 | public function __construct(FileInterface $file) |
||
28 | { |
||
29 | $this->file = $file; |
||
30 | |||
31 | $this->error = $file->error(); |
||
32 | |||
33 | $this->name = $file->name(); |
||
34 | |||
35 | $this->size = $file->size(); |
||
36 | |||
37 | $this->media = $file->type(); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Retrieve a stream representing the uploaded file. |
||
42 | * |
||
43 | * @return \Psr\Http\Message\StreamInterface |
||
44 | * |
||
45 | * @throws \RuntimeException |
||
46 | */ |
||
47 | public function getStream() |
||
48 | { |
||
49 | 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 | public function moveTo($target) |
||
63 | } |
||
64 | } |
||
65 |