| 1 | <?php |
||
| 14 | class File implements FileInterface |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var \Psr\Http\Message\UploadedFileInterface |
||
| 18 | */ |
||
| 19 | protected $file; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Initializes the uploaded file instance. |
||
| 23 | * |
||
| 24 | * @param \Psr\Http\Message\UploadedFileInterface $file |
||
| 25 | */ |
||
| 26 | 45 | public function __construct(UploadedFileInterface $file) |
|
| 30 | |||
| 31 | /** |
||
| 32 | * Returns the filename sent by the client. |
||
| 33 | * |
||
| 34 | * @return string|null |
||
| 35 | */ |
||
| 36 | 3 | public function name() |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Returns the media type sent by the client. |
||
| 43 | * |
||
| 44 | * @return string|null |
||
| 45 | */ |
||
| 46 | 3 | public function type() |
|
| 50 | |||
| 51 | /** |
||
| 52 | * Returns the error associated with the uploaded file. |
||
| 53 | * |
||
| 54 | * @return integer |
||
| 55 | */ |
||
| 56 | 3 | public function error() |
|
| 60 | |||
| 61 | /** |
||
| 62 | * Returns the file size. |
||
| 63 | * |
||
| 64 | * @return integer|null |
||
| 65 | */ |
||
| 66 | 3 | public function size() |
|
| 70 | |||
| 71 | /** |
||
| 72 | * Returns a stream representing the uploaded file. |
||
| 73 | * |
||
| 74 | * @return \Psr\Http\Message\StreamInterface |
||
| 75 | * |
||
| 76 | * @throws \RuntimeException |
||
| 77 | */ |
||
| 78 | 3 | public function stream() |
|
| 82 | |||
| 83 | /** |
||
| 84 | * Moves the uploaded file to a new location. |
||
| 85 | * |
||
| 86 | * @param string $target |
||
| 87 | * |
||
| 88 | * @throws \InvalidArgumentException |
||
| 89 | * @throws \RuntimeException |
||
| 90 | */ |
||
| 91 | 3 | public function move($target) |
|
| 95 | } |
||
| 96 |