Total Complexity | 9 |
Total Lines | 61 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | class UploadedFile extends File { |
||
11 | |||
12 | private $originalName; |
||
13 | private $mimeType; |
||
14 | private $error; |
||
15 | |||
16 | public function __construct(string $path, string $name, string $mimeType = null, int $error = null) { |
||
17 | $this->mimeType = $mimeType ?: 'application/octet-stream'; |
||
18 | $this->error = $error ?: UPLOAD_ERR_OK; |
||
19 | $this->originalName = pathinfo($name, PATHINFO_FILENAME); |
||
20 | parent::__construct($path); |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * Get the value of error |
||
25 | */ |
||
26 | public function getError() |
||
27 | { |
||
28 | return $this->error; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Set the value of error |
||
33 | * |
||
34 | * @return self |
||
35 | */ |
||
36 | public function setError($error) |
||
37 | { |
||
38 | $this->error = $error; |
||
39 | |||
40 | return $this; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Get the value of mimeType |
||
45 | */ |
||
46 | public function getMimeType() |
||
47 | { |
||
48 | return $this->mimeType; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Set the value of mimeType |
||
53 | * |
||
54 | * @return self |
||
55 | */ |
||
56 | public function setMimeType($mimeType) |
||
57 | { |
||
58 | $this->mimeType = $mimeType; |
||
59 | |||
60 | return $this; |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * 判断文件是否可用 |
||
65 | * |
||
66 | * @return boolean |
||
67 | */ |
||
68 | public function isValid() |
||
71 | } |
||
72 | } |