1 | <?php |
||
7 | class ChunkFile |
||
8 | { |
||
9 | /** |
||
10 | * TMPFILE_EXTENSION. |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | const TMPFILE_EXTENSION = '.part'; |
||
15 | |||
16 | /** |
||
17 | * $token. |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $token = null; |
||
22 | |||
23 | /** |
||
24 | * $chunkPath. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $chunkPath = null; |
||
29 | |||
30 | /** |
||
31 | * $storagePath. |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $storagePath = null; |
||
36 | |||
37 | /** |
||
38 | * $name. |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $name = null; |
||
43 | |||
44 | /** |
||
45 | * $mimeType. |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | protected $mimeType = null; |
||
50 | |||
51 | /** |
||
52 | * $tmpfilename. |
||
53 | * |
||
54 | * @var string |
||
55 | */ |
||
56 | protected $tmpfilename = null; |
||
57 | |||
58 | /** |
||
59 | * __construct. |
||
60 | * |
||
61 | * @param \Recca0120\Upload\Filesystem $filesystem |
||
62 | */ |
||
63 | 17 | public function __construct(Filesystem $filesystem = null) |
|
67 | |||
68 | /** |
||
69 | * setToken. |
||
70 | * |
||
71 | * @param string $token |
||
72 | * @return $this |
||
73 | */ |
||
74 | 5 | public function setToken($token) |
|
80 | |||
81 | /** |
||
82 | * setChunkPath. |
||
83 | * |
||
84 | * @param string $chunkPath |
||
85 | * @return $this |
||
86 | */ |
||
87 | 5 | public function setChunkPath($chunkPath) |
|
93 | |||
94 | /** |
||
95 | * setStoragePath. |
||
96 | * |
||
97 | * @param string $storagePath |
||
98 | * @return $this |
||
99 | */ |
||
100 | 5 | public function setStoragePath($storagePath) |
|
106 | |||
107 | /** |
||
108 | * setName. |
||
109 | * |
||
110 | * @param string $name |
||
111 | * @return $this |
||
112 | */ |
||
113 | 5 | public function setName($name) |
|
119 | |||
120 | /** |
||
121 | * setMimeType. |
||
122 | * |
||
123 | * @param string $name |
||
124 | * @return $this |
||
125 | */ |
||
126 | 5 | public function setMimeType($mimeType) |
|
132 | |||
133 | /** |
||
134 | * throwException. |
||
135 | * |
||
136 | * @param string $message |
||
137 | * @param array $headers |
||
138 | * @throws \Recca0120\Upload\Exceptions\ChunkedResponseException |
||
139 | */ |
||
140 | 2 | public function throwException($message = '', $headers = []) |
|
144 | |||
145 | /** |
||
146 | * appendStream. |
||
147 | * |
||
148 | * @param mixed $source |
||
149 | * @param int $offset |
||
150 | * @return $this |
||
151 | */ |
||
152 | 5 | public function appendStream($source, $offset = 0) |
|
158 | |||
159 | 3 | public function createUploadedFile() |
|
172 | |||
173 | /** |
||
174 | * tmpfilename. |
||
175 | * |
||
176 | * @return string |
||
177 | */ |
||
178 | 5 | protected function tmpfilename() |
|
186 | |||
187 | /** |
||
188 | * chunkFile. |
||
189 | * |
||
190 | * @return string |
||
191 | */ |
||
192 | 5 | protected function chunkFile() |
|
196 | |||
197 | /** |
||
198 | * storageFile. |
||
199 | * |
||
200 | * @return string |
||
201 | */ |
||
202 | 3 | protected function storageFile() |
|
206 | } |
||
207 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: