19 self::PROPERTY_TYPE_BOOLEAN,
20 self::PROPERTY_TYPE_INTEGER,
21 self::PROPERTY_TYPE_FLOAT,
22 self::PROPERTY_TYPE_DATE,
23 self::PROPERTY_TYPE_STRING,
59 private $title =
'Untitled Spreadsheet';
117 $this->created = self::intOrFloatTimestamp(null);
118 $this->modified = self::intOrFloatTimestamp(null);
156 $this->lastModifiedBy = $modifier;
201 $this->created = self::intOrFloatTimestamp(
$timestamp);
225 $this->modified = self::intOrFloatTimestamp(
$timestamp);
377 return array_keys($this->customProperties);
385 return array_key_exists($propertyName, $this->customProperties);
395 if (isset($this->customProperties[$propertyName])) {
396 return $this->customProperties[$propertyName][
'value'];
409 return $this->customProperties[$propertyName][
'type'] ?? null;
417 if (is_float($propertyValue)) {
418 return self::PROPERTY_TYPE_FLOAT;
420 if (is_int($propertyValue)) {
421 return self::PROPERTY_TYPE_INTEGER;
423 if (is_bool($propertyValue)) {
424 return self::PROPERTY_TYPE_BOOLEAN;
427 return self::PROPERTY_TYPE_STRING;
443 public function setCustomProperty(
string $propertyName, $propertyValue =
'', $propertyType = null): self
445 if (($propertyType === null) || (!in_array($propertyType, self::VALID_PROPERTY_TYPE_LIST))) {
449 if (!is_object($propertyValue)) {
450 $this->customProperties[$propertyName] = [
451 'value' => self::convertProperty($propertyValue, $propertyType),
452 'type' => $propertyType,
460 'i' => self::PROPERTY_TYPE_INTEGER,
461 'i1' => self::PROPERTY_TYPE_INTEGER,
462 'i2' => self::PROPERTY_TYPE_INTEGER,
463 'i4' => self::PROPERTY_TYPE_INTEGER,
464 'i8' => self::PROPERTY_TYPE_INTEGER,
465 'int' => self::PROPERTY_TYPE_INTEGER,
466 'ui1' => self::PROPERTY_TYPE_INTEGER,
467 'ui2' => self::PROPERTY_TYPE_INTEGER,
468 'ui4' => self::PROPERTY_TYPE_INTEGER,
469 'ui8' => self::PROPERTY_TYPE_INTEGER,
470 'uint' => self::PROPERTY_TYPE_INTEGER,
471 'f' => self::PROPERTY_TYPE_FLOAT,
472 'r4' => self::PROPERTY_TYPE_FLOAT,
473 'r8' => self::PROPERTY_TYPE_FLOAT,
474 'decimal' => self::PROPERTY_TYPE_FLOAT,
475 's' => self::PROPERTY_TYPE_STRING,
476 'empty' => self::PROPERTY_TYPE_STRING,
477 'null' => self::PROPERTY_TYPE_STRING,
478 'lpstr' => self::PROPERTY_TYPE_STRING,
479 'lpwstr' => self::PROPERTY_TYPE_STRING,
480 'bstr' => self::PROPERTY_TYPE_STRING,
481 'd' => self::PROPERTY_TYPE_DATE,
482 'date' => self::PROPERTY_TYPE_DATE,
483 'filetime' => self::PROPERTY_TYPE_DATE,
484 'b' => self::PROPERTY_TYPE_BOOLEAN,
485 'bool' => self::PROPERTY_TYPE_BOOLEAN,
502 return self::SPECIAL_TYPES[$propertyType] ?? self::convertProperty2($propertyValue, $propertyType);
514 $propertyType = self::convertPropertyType($type);
515 switch ($propertyType) {
516 case self::PROPERTY_TYPE_INTEGER:
517 $intValue = (int) $propertyValue;
519 return ($type[0] ===
'u') ? abs($intValue) : $intValue;
520 case self::PROPERTY_TYPE_FLOAT:
521 return (
float) $propertyValue;
522 case self::PROPERTY_TYPE_DATE:
523 return self::intOrFloatTimestamp($propertyValue);
524 case self::PROPERTY_TYPE_BOOLEAN:
525 return is_bool($propertyValue) ? $propertyValue : ($propertyValue ===
'true');
527 return $propertyValue;
533 return self::PROPERTY_TYPE_ARRAY[$propertyType] ?? self::PROPERTY_TYPE_UNKNOWN;
setCompany(string $company)
Set Company.
const const static convertProperty($propertyValue, string $propertyType)
Convert property to form desired by Excel.
const PROPERTY_TYPE_ARRAY
static evaluate($value)
Help some functions with large results operate correctly on 32-bit, by returning result as int when p...
static convertProperty2($propertyValue, string $type)
Convert property to form desired by Excel.
const PROPERTY_TYPE_INTEGER
getKeywords()
Get Keywords.
__construct()
Create a new Document Properties instance.
setKeywords(string $keywords)
Set Keywords.
const VALID_PROPERTY_TYPE_LIST
setDescription(string $description)
Set Description.
setLastModifiedBy(string $modifier)
Set Last Modified By.
getDescription()
Get Description.
getLastModifiedBy()
Get Last Modified By.
const PROPERTY_TYPE_FLOAT
const const SPECIAL_TYPES
getCategory()
Get Category.
getCustomPropertyType(string $propertyName)
Get a Custom Property Type.
getCustomPropertyValue(string $propertyName)
Get a Custom Property Value.
setCreated($timestamp)
Set Created.
const PROPERTY_TYPE_STRING
setCategory(string $category)
Set Category.
const PROPERTY_TYPE_BOOLEAN
constants
static intOrFloatTimestamp($timestamp)
foreach($mandatory_scripts as $file) $timestamp
setCreator(string $creator)
Set Creator.
identifyPropertyType($propertyValue)
setSubject(string $subject)
Set Subject.
const PROPERTY_TYPE_UNKNOWN
setTitle(string $title)
Set Title.
getModified()
Get Modified.
setManager(string $manager)
Set Manager.
setModified($timestamp)
Set Modified.
isCustomPropertySet(string $propertyName)
Check if a Custom Property is defined.
getCustomProperties()
Get a List of Custom Property Names.
static convertPropertyType(string $propertyType)
setCustomProperty(string $propertyName, $propertyValue='', $propertyType=null)
Set a Custom Property.