1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PhpOffice\PhpSpreadsheet\Document; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Copyright (c) 2006 - 2016 PhpSpreadsheet. |
7
|
|
|
* |
8
|
|
|
* This library is free software; you can redistribute it and/or |
9
|
|
|
* modify it under the terms of the GNU Lesser General Public |
10
|
|
|
* License as published by the Free Software Foundation; either |
11
|
|
|
* version 2.1 of the License, or (at your option) any later version. |
12
|
|
|
* |
13
|
|
|
* This library is distributed in the hope that it will be useful, |
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16
|
|
|
* Lesser General Public License for more details. |
17
|
|
|
* |
18
|
|
|
* You should have received a copy of the GNU Lesser General Public |
19
|
|
|
* License along with this library; if not, write to the Free Software |
20
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
21
|
|
|
* |
22
|
|
|
* @category PhpSpreadsheet |
23
|
|
|
* |
24
|
|
|
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) |
25
|
|
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
26
|
|
|
*/ |
27
|
|
|
class Properties |
28
|
|
|
{ |
29
|
|
|
/** constants */ |
30
|
|
|
const PROPERTY_TYPE_BOOLEAN = 'b'; |
31
|
|
|
const PROPERTY_TYPE_INTEGER = 'i'; |
32
|
|
|
const PROPERTY_TYPE_FLOAT = 'f'; |
33
|
|
|
const PROPERTY_TYPE_DATE = 'd'; |
34
|
|
|
const PROPERTY_TYPE_STRING = 's'; |
35
|
|
|
const PROPERTY_TYPE_UNKNOWN = 'u'; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Creator. |
39
|
|
|
* |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
private $creator = 'Unknown Creator'; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* LastModifiedBy. |
46
|
|
|
* |
47
|
|
|
* @var string |
48
|
|
|
*/ |
49
|
|
|
private $lastModifiedBy; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Created. |
53
|
|
|
* |
54
|
|
|
* @var int |
55
|
|
|
*/ |
56
|
|
|
private $created; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Modified. |
60
|
|
|
* |
61
|
|
|
* @var int |
62
|
|
|
*/ |
63
|
|
|
private $modified; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Title. |
67
|
|
|
* |
68
|
|
|
* @var string |
69
|
|
|
*/ |
70
|
|
|
private $title = 'Untitled Spreadsheet'; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Description. |
74
|
|
|
* |
75
|
|
|
* @var string |
76
|
|
|
*/ |
77
|
|
|
private $description = ''; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Subject. |
81
|
|
|
* |
82
|
|
|
* @var string |
83
|
|
|
*/ |
84
|
|
|
private $subject = ''; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Keywords. |
88
|
|
|
* |
89
|
|
|
* @var string |
90
|
|
|
*/ |
91
|
|
|
private $keywords = ''; |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Category. |
95
|
|
|
* |
96
|
|
|
* @var string |
97
|
|
|
*/ |
98
|
|
|
private $category = ''; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Manager. |
102
|
|
|
* |
103
|
|
|
* @var string |
104
|
|
|
*/ |
105
|
|
|
private $manager = ''; |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Company. |
109
|
|
|
* |
110
|
|
|
* @var string |
111
|
|
|
*/ |
112
|
|
|
private $company = 'Microsoft Corporation'; |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Custom Properties. |
116
|
|
|
* |
117
|
|
|
* @var string |
118
|
|
|
*/ |
119
|
|
|
private $customProperties = []; |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Create a new Document Properties instance. |
123
|
|
|
*/ |
124
|
73 |
|
public function __construct() |
125
|
|
|
{ |
126
|
|
|
// Initialise values |
127
|
73 |
|
$this->lastModifiedBy = $this->creator; |
128
|
73 |
|
$this->created = time(); |
129
|
73 |
|
$this->modified = time(); |
130
|
73 |
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Get Creator. |
134
|
|
|
* |
135
|
|
|
* @return string |
136
|
|
|
*/ |
137
|
58 |
|
public function getCreator() |
138
|
|
|
{ |
139
|
58 |
|
return $this->creator; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Set Creator. |
144
|
|
|
* |
145
|
|
|
* @param string $creator |
146
|
|
|
* |
147
|
|
|
* @return Properties |
148
|
|
|
*/ |
149
|
48 |
|
public function setCreator($creator) |
150
|
|
|
{ |
151
|
48 |
|
$this->creator = $creator; |
152
|
|
|
|
153
|
48 |
|
return $this; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* Get Last Modified By. |
158
|
|
|
* |
159
|
|
|
* @return string |
160
|
|
|
*/ |
161
|
54 |
|
public function getLastModifiedBy() |
162
|
|
|
{ |
163
|
54 |
|
return $this->lastModifiedBy; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Set Last Modified By. |
168
|
|
|
* |
169
|
|
|
* @param string $pValue |
170
|
|
|
* |
171
|
|
|
* @return Properties |
172
|
|
|
*/ |
173
|
43 |
|
public function setLastModifiedBy($pValue) |
174
|
|
|
{ |
175
|
43 |
|
$this->lastModifiedBy = $pValue; |
176
|
|
|
|
177
|
43 |
|
return $this; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* Get Created. |
182
|
|
|
* |
183
|
|
|
* @return int |
184
|
|
|
*/ |
185
|
54 |
|
public function getCreated() |
186
|
|
|
{ |
187
|
54 |
|
return $this->created; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* Set Created. |
192
|
|
|
* |
193
|
|
|
* @param datetime $pValue |
194
|
|
|
* |
195
|
|
|
* @return Properties |
196
|
|
|
*/ |
197
|
19 |
View Code Duplication |
public function setCreated($pValue) |
|
|
|
|
198
|
|
|
{ |
199
|
19 |
|
if ($pValue === null) { |
200
|
|
|
$pValue = time(); |
201
|
19 |
|
} elseif (is_string($pValue)) { |
202
|
|
|
if (is_numeric($pValue)) { |
203
|
|
|
$pValue = (int) $pValue; |
204
|
|
|
} else { |
205
|
|
|
$pValue = strtotime($pValue); |
206
|
|
|
} |
207
|
|
|
} |
208
|
|
|
|
209
|
19 |
|
$this->created = $pValue; |
|
|
|
|
210
|
|
|
|
211
|
19 |
|
return $this; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* Get Modified. |
216
|
|
|
* |
217
|
|
|
* @return int |
218
|
|
|
*/ |
219
|
54 |
|
public function getModified() |
220
|
|
|
{ |
221
|
54 |
|
return $this->modified; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
/** |
225
|
|
|
* Set Modified. |
226
|
|
|
* |
227
|
|
|
* @param datetime $pValue |
228
|
|
|
* |
229
|
|
|
* @return Properties |
230
|
|
|
*/ |
231
|
19 |
View Code Duplication |
public function setModified($pValue) |
|
|
|
|
232
|
|
|
{ |
233
|
19 |
|
if ($pValue === null) { |
234
|
|
|
$pValue = time(); |
235
|
19 |
|
} elseif (is_string($pValue)) { |
236
|
|
|
if (is_numeric($pValue)) { |
237
|
|
|
$pValue = (int) $pValue; |
238
|
|
|
} else { |
239
|
|
|
$pValue = strtotime($pValue); |
240
|
|
|
} |
241
|
|
|
} |
242
|
|
|
|
243
|
19 |
|
$this->modified = $pValue; |
|
|
|
|
244
|
|
|
|
245
|
19 |
|
return $this; |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
/** |
249
|
|
|
* Get Title. |
250
|
|
|
* |
251
|
|
|
* @return string |
252
|
|
|
*/ |
253
|
58 |
|
public function getTitle() |
254
|
|
|
{ |
255
|
58 |
|
return $this->title; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
/** |
259
|
|
|
* Set Title. |
260
|
|
|
* |
261
|
|
|
* @param string $title |
262
|
|
|
* |
263
|
|
|
* @return Properties |
264
|
|
|
*/ |
265
|
47 |
|
public function setTitle($title) |
266
|
|
|
{ |
267
|
47 |
|
$this->title = $title; |
268
|
|
|
|
269
|
47 |
|
return $this; |
270
|
|
|
} |
271
|
|
|
|
272
|
|
|
/** |
273
|
|
|
* Get Description. |
274
|
|
|
* |
275
|
|
|
* @return string |
276
|
|
|
*/ |
277
|
58 |
|
public function getDescription() |
278
|
|
|
{ |
279
|
58 |
|
return $this->description; |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
/** |
283
|
|
|
* Set Description. |
284
|
|
|
* |
285
|
|
|
* @param string $description |
286
|
|
|
* |
287
|
|
|
* @return Properties |
288
|
|
|
*/ |
289
|
47 |
|
public function setDescription($description) |
290
|
|
|
{ |
291
|
47 |
|
$this->description = $description; |
292
|
|
|
|
293
|
47 |
|
return $this; |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
/** |
297
|
|
|
* Get Subject. |
298
|
|
|
* |
299
|
|
|
* @return string |
300
|
|
|
*/ |
301
|
58 |
|
public function getSubject() |
302
|
|
|
{ |
303
|
58 |
|
return $this->subject; |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
/** |
307
|
|
|
* Set Subject. |
308
|
|
|
* |
309
|
|
|
* @param string $subject |
310
|
|
|
* |
311
|
|
|
* @return Properties |
312
|
|
|
*/ |
313
|
47 |
|
public function setSubject($subject) |
314
|
|
|
{ |
315
|
47 |
|
$this->subject = $subject; |
316
|
|
|
|
317
|
47 |
|
return $this; |
318
|
|
|
} |
319
|
|
|
|
320
|
|
|
/** |
321
|
|
|
* Get Keywords. |
322
|
|
|
* |
323
|
|
|
* @return string |
324
|
|
|
*/ |
325
|
58 |
|
public function getKeywords() |
326
|
|
|
{ |
327
|
58 |
|
return $this->keywords; |
328
|
|
|
} |
329
|
|
|
|
330
|
|
|
/** |
331
|
|
|
* Set Keywords. |
332
|
|
|
* |
333
|
|
|
* @param string $keywords |
334
|
|
|
* |
335
|
|
|
* @return Properties |
336
|
|
|
*/ |
337
|
47 |
|
public function setKeywords($keywords) |
338
|
|
|
{ |
339
|
47 |
|
$this->keywords = $keywords; |
340
|
|
|
|
341
|
47 |
|
return $this; |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
/** |
345
|
|
|
* Get Category. |
346
|
|
|
* |
347
|
|
|
* @return string |
348
|
|
|
*/ |
349
|
58 |
|
public function getCategory() |
350
|
|
|
{ |
351
|
58 |
|
return $this->category; |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
/** |
355
|
|
|
* Set Category. |
356
|
|
|
* |
357
|
|
|
* @param string $category |
358
|
|
|
* |
359
|
|
|
* @return Properties |
360
|
|
|
*/ |
361
|
42 |
|
public function setCategory($category) |
362
|
|
|
{ |
363
|
42 |
|
$this->category = $category; |
364
|
|
|
|
365
|
42 |
|
return $this; |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
/** |
369
|
|
|
* Get Company. |
370
|
|
|
* |
371
|
|
|
* @return string |
372
|
|
|
*/ |
373
|
57 |
|
public function getCompany() |
374
|
|
|
{ |
375
|
57 |
|
return $this->company; |
376
|
|
|
} |
377
|
|
|
|
378
|
|
|
/** |
379
|
|
|
* Set Company. |
380
|
|
|
* |
381
|
|
|
* @param string $company |
382
|
|
|
* |
383
|
|
|
* @return Properties |
384
|
|
|
*/ |
385
|
10 |
|
public function setCompany($company) |
386
|
|
|
{ |
387
|
10 |
|
$this->company = $company; |
388
|
|
|
|
389
|
10 |
|
return $this; |
390
|
|
|
} |
391
|
|
|
|
392
|
|
|
/** |
393
|
|
|
* Get Manager. |
394
|
|
|
* |
395
|
|
|
* @return string |
396
|
|
|
*/ |
397
|
57 |
|
public function getManager() |
398
|
|
|
{ |
399
|
57 |
|
return $this->manager; |
400
|
|
|
} |
401
|
|
|
|
402
|
|
|
/** |
403
|
|
|
* Set Manager. |
404
|
|
|
* |
405
|
|
|
* @param string $manager |
406
|
|
|
* |
407
|
|
|
* @return Properties |
408
|
|
|
*/ |
409
|
6 |
|
public function setManager($manager) |
410
|
|
|
{ |
411
|
6 |
|
$this->manager = $manager; |
412
|
|
|
|
413
|
6 |
|
return $this; |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
/** |
417
|
|
|
* Get a List of Custom Property Names. |
418
|
|
|
* |
419
|
|
|
* @return array of string |
420
|
|
|
*/ |
421
|
53 |
|
public function getCustomProperties() |
422
|
|
|
{ |
423
|
53 |
|
return array_keys($this->customProperties); |
424
|
|
|
} |
425
|
|
|
|
426
|
|
|
/** |
427
|
|
|
* Check if a Custom Property is defined. |
428
|
|
|
* |
429
|
|
|
* @param string $propertyName |
430
|
|
|
* |
431
|
|
|
* @return bool |
432
|
|
|
*/ |
433
|
|
|
public function isCustomPropertySet($propertyName) |
434
|
|
|
{ |
435
|
|
|
return isset($this->customProperties[$propertyName]); |
436
|
|
|
} |
437
|
|
|
|
438
|
|
|
/** |
439
|
|
|
* Get a Custom Property Value. |
440
|
|
|
* |
441
|
|
|
* @param string $propertyName |
442
|
|
|
* |
443
|
|
|
* @return string |
444
|
|
|
*/ |
445
|
1 |
|
public function getCustomPropertyValue($propertyName) |
446
|
|
|
{ |
447
|
1 |
|
if (isset($this->customProperties[$propertyName])) { |
448
|
1 |
|
return $this->customProperties[$propertyName]['value']; |
449
|
|
|
} |
450
|
|
|
} |
451
|
|
|
|
452
|
|
|
/** |
453
|
|
|
* Get a Custom Property Type. |
454
|
|
|
* |
455
|
|
|
* @param string $propertyName |
456
|
|
|
* |
457
|
|
|
* @return string |
458
|
|
|
*/ |
459
|
1 |
|
public function getCustomPropertyType($propertyName) |
460
|
|
|
{ |
461
|
1 |
|
if (isset($this->customProperties[$propertyName])) { |
462
|
1 |
|
return $this->customProperties[$propertyName]['type']; |
463
|
|
|
} |
464
|
|
|
} |
465
|
|
|
|
466
|
|
|
/** |
467
|
|
|
* Set a Custom Property. |
468
|
|
|
* |
469
|
|
|
* @param string $propertyName |
470
|
|
|
* @param mixed $propertyValue |
471
|
|
|
* @param string $propertyType |
472
|
|
|
* 'i' : Integer |
473
|
|
|
* 'f' : Floating Point |
474
|
|
|
* 's' : String |
475
|
|
|
* 'd' : Date/Time |
476
|
|
|
* 'b' : Boolean |
477
|
|
|
* |
478
|
|
|
* @return Properties |
479
|
|
|
*/ |
480
|
5 |
|
public function setCustomProperty($propertyName, $propertyValue = '', $propertyType = null) |
481
|
|
|
{ |
482
|
5 |
|
if (($propertyType === null) || (!in_array($propertyType, [self::PROPERTY_TYPE_INTEGER, |
483
|
5 |
|
self::PROPERTY_TYPE_FLOAT, |
484
|
5 |
|
self::PROPERTY_TYPE_STRING, |
485
|
5 |
|
self::PROPERTY_TYPE_DATE, |
486
|
5 |
|
self::PROPERTY_TYPE_BOOLEAN, ]))) { |
487
|
|
|
if ($propertyValue === null) { |
488
|
|
|
$propertyType = self::PROPERTY_TYPE_STRING; |
489
|
|
|
} elseif (is_float($propertyValue)) { |
490
|
|
|
$propertyType = self::PROPERTY_TYPE_FLOAT; |
491
|
|
|
} elseif (is_int($propertyValue)) { |
492
|
|
|
$propertyType = self::PROPERTY_TYPE_INTEGER; |
493
|
|
|
} elseif (is_bool($propertyValue)) { |
494
|
|
|
$propertyType = self::PROPERTY_TYPE_BOOLEAN; |
495
|
|
|
} else { |
496
|
|
|
$propertyType = self::PROPERTY_TYPE_STRING; |
497
|
|
|
} |
498
|
|
|
} |
499
|
|
|
|
500
|
5 |
|
$this->customProperties[$propertyName] = [ |
501
|
5 |
|
'value' => $propertyValue, |
502
|
5 |
|
'type' => $propertyType, |
503
|
|
|
]; |
504
|
|
|
|
505
|
5 |
|
return $this; |
506
|
|
|
} |
507
|
|
|
|
508
|
|
|
/** |
509
|
|
|
* Implement PHP __clone to create a deep clone, not just a shallow copy. |
510
|
|
|
*/ |
511
|
|
View Code Duplication |
public function __clone() |
|
|
|
|
512
|
|
|
{ |
513
|
|
|
$vars = get_object_vars($this); |
514
|
|
|
foreach ($vars as $key => $value) { |
515
|
|
|
if (is_object($value)) { |
516
|
|
|
$this->$key = clone $value; |
517
|
|
|
} else { |
518
|
|
|
$this->$key = $value; |
519
|
|
|
} |
520
|
|
|
} |
521
|
|
|
} |
522
|
|
|
|
523
|
|
|
public static function convertProperty($propertyValue, $propertyType) |
524
|
|
|
{ |
525
|
|
|
switch ($propertyType) { |
526
|
|
|
case 'empty': // Empty |
527
|
|
|
return ''; |
528
|
|
|
break; |
|
|
|
|
529
|
|
|
case 'null': // Null |
530
|
|
|
return null; |
531
|
|
|
break; |
|
|
|
|
532
|
|
|
case 'i1': // 1-Byte Signed Integer |
533
|
|
|
case 'i2': // 2-Byte Signed Integer |
534
|
|
|
case 'i4': // 4-Byte Signed Integer |
535
|
|
|
case 'i8': // 8-Byte Signed Integer |
536
|
|
|
case 'int': // Integer |
537
|
|
|
return (int) $propertyValue; |
538
|
|
|
break; |
|
|
|
|
539
|
|
|
case 'ui1': // 1-Byte Unsigned Integer |
540
|
|
|
case 'ui2': // 2-Byte Unsigned Integer |
541
|
|
|
case 'ui4': // 4-Byte Unsigned Integer |
542
|
|
|
case 'ui8': // 8-Byte Unsigned Integer |
543
|
|
|
case 'uint': // Unsigned Integer |
544
|
|
|
return abs((int) $propertyValue); |
545
|
|
|
break; |
|
|
|
|
546
|
|
|
case 'r4': // 4-Byte Real Number |
547
|
|
|
case 'r8': // 8-Byte Real Number |
548
|
|
|
case 'decimal': // Decimal |
549
|
|
|
return (float) $propertyValue; |
550
|
|
|
break; |
|
|
|
|
551
|
|
|
case 'lpstr': // LPSTR |
552
|
|
|
case 'lpwstr': // LPWSTR |
553
|
|
|
case 'bstr': // Basic String |
554
|
|
|
return $propertyValue; |
555
|
|
|
break; |
|
|
|
|
556
|
|
|
case 'date': // Date and Time |
557
|
|
|
case 'filetime': // File Time |
558
|
|
|
return strtotime($propertyValue); |
559
|
|
|
break; |
|
|
|
|
560
|
|
|
case 'bool': // Boolean |
561
|
|
|
return ($propertyValue == 'true') ? true : false; |
562
|
|
|
break; |
|
|
|
|
563
|
|
|
case 'cy': // Currency |
564
|
|
|
case 'error': // Error Status Code |
565
|
|
|
case 'vector': // Vector |
566
|
|
|
case 'array': // Array |
567
|
|
|
case 'blob': // Binary Blob |
568
|
|
|
case 'oblob': // Binary Blob Object |
569
|
|
|
case 'stream': // Binary Stream |
570
|
|
|
case 'ostream': // Binary Stream Object |
571
|
|
|
case 'storage': // Binary Storage |
572
|
|
|
case 'ostorage': // Binary Storage Object |
573
|
|
|
case 'vstream': // Binary Versioned Stream |
574
|
|
|
case 'clsid': // Class ID |
575
|
|
|
case 'cf': // Clipboard Data |
576
|
|
|
return $propertyValue; |
577
|
|
|
break; |
|
|
|
|
578
|
|
|
} |
579
|
|
|
|
580
|
|
|
return $propertyValue; |
581
|
|
|
} |
582
|
|
|
|
583
|
|
|
public static function convertPropertyType($propertyType) |
584
|
|
|
{ |
585
|
|
|
switch ($propertyType) { |
586
|
|
|
case 'i1': // 1-Byte Signed Integer |
587
|
|
|
case 'i2': // 2-Byte Signed Integer |
588
|
|
|
case 'i4': // 4-Byte Signed Integer |
589
|
|
|
case 'i8': // 8-Byte Signed Integer |
590
|
|
|
case 'int': // Integer |
591
|
|
|
case 'ui1': // 1-Byte Unsigned Integer |
592
|
|
|
case 'ui2': // 2-Byte Unsigned Integer |
593
|
|
|
case 'ui4': // 4-Byte Unsigned Integer |
594
|
|
|
case 'ui8': // 8-Byte Unsigned Integer |
595
|
|
|
case 'uint': // Unsigned Integer |
596
|
|
|
return self::PROPERTY_TYPE_INTEGER; |
597
|
|
|
break; |
|
|
|
|
598
|
|
|
case 'r4': // 4-Byte Real Number |
599
|
|
|
case 'r8': // 8-Byte Real Number |
600
|
|
|
case 'decimal': // Decimal |
601
|
|
|
return self::PROPERTY_TYPE_FLOAT; |
602
|
|
|
break; |
|
|
|
|
603
|
|
|
case 'empty': // Empty |
604
|
|
|
case 'null': // Null |
605
|
|
|
case 'lpstr': // LPSTR |
606
|
|
|
case 'lpwstr': // LPWSTR |
607
|
|
|
case 'bstr': // Basic String |
608
|
|
|
return self::PROPERTY_TYPE_STRING; |
609
|
|
|
break; |
|
|
|
|
610
|
|
|
case 'date': // Date and Time |
611
|
|
|
case 'filetime': // File Time |
612
|
|
|
return self::PROPERTY_TYPE_DATE; |
613
|
|
|
break; |
|
|
|
|
614
|
|
|
case 'bool': // Boolean |
615
|
|
|
return self::PROPERTY_TYPE_BOOLEAN; |
616
|
|
|
break; |
|
|
|
|
617
|
|
|
case 'cy': // Currency |
618
|
|
|
case 'error': // Error Status Code |
619
|
|
|
case 'vector': // Vector |
620
|
|
|
case 'array': // Array |
621
|
|
|
case 'blob': // Binary Blob |
622
|
|
|
case 'oblob': // Binary Blob Object |
623
|
|
|
case 'stream': // Binary Stream |
624
|
|
|
case 'ostream': // Binary Stream Object |
625
|
|
|
case 'storage': // Binary Storage |
626
|
|
|
case 'ostorage': // Binary Storage Object |
627
|
|
|
case 'vstream': // Binary Versioned Stream |
628
|
|
|
case 'clsid': // Class ID |
629
|
|
|
case 'cf': // Clipboard Data |
630
|
|
|
return self::PROPERTY_TYPE_UNKNOWN; |
631
|
|
|
break; |
|
|
|
|
632
|
|
|
} |
633
|
|
|
|
634
|
|
|
return self::PROPERTY_TYPE_UNKNOWN; |
635
|
|
|
} |
636
|
|
|
} |
637
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.