ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PhpOffice\PhpSpreadsheet\Document\Properties Class Reference
+ Collaboration diagram for PhpOffice\PhpSpreadsheet\Document\Properties:

Public Member Functions

 __construct ()
 Create a new Document Properties instance. More...
 
 getCreator ()
 Get Creator. More...
 
 setCreator (string $creator)
 Set Creator. More...
 
 getLastModifiedBy ()
 Get Last Modified By. More...
 
 setLastModifiedBy (string $modifier)
 Set Last Modified By. More...
 
 getCreated ()
 Get Created. More...
 
 setCreated ($timestamp)
 Set Created. More...
 
 getModified ()
 Get Modified. More...
 
 setModified ($timestamp)
 Set Modified. More...
 
 getTitle ()
 Get Title. More...
 
 setTitle (string $title)
 Set Title. More...
 
 getDescription ()
 Get Description. More...
 
 setDescription (string $description)
 Set Description. More...
 
 getSubject ()
 Get Subject. More...
 
 setSubject (string $subject)
 Set Subject. More...
 
 getKeywords ()
 Get Keywords. More...
 
 setKeywords (string $keywords)
 Set Keywords. More...
 
 getCategory ()
 Get Category. More...
 
 setCategory (string $category)
 Set Category. More...
 
 getCompany ()
 Get Company. More...
 
 setCompany (string $company)
 Set Company. More...
 
 getManager ()
 Get Manager. More...
 
 setManager (string $manager)
 Set Manager. More...
 
 getCustomProperties ()
 Get a List of Custom Property Names. More...
 
 isCustomPropertySet (string $propertyName)
 Check if a Custom Property is defined. More...
 
 getCustomPropertyValue (string $propertyName)
 Get a Custom Property Value. More...
 
 getCustomPropertyType (string $propertyName)
 Get a Custom Property Type. More...
 
 setCustomProperty (string $propertyName, $propertyValue='', $propertyType=null)
 Set a Custom Property. More...
 

Static Public Member Functions

const const static convertProperty ($propertyValue, string $propertyType)
 Convert property to form desired by Excel. More...
 
static convertPropertyType (string $propertyType)
 

Data Fields

const PROPERTY_TYPE_BOOLEAN = 'b'
 constants More...
 
const PROPERTY_TYPE_INTEGER = 'i'
 
const PROPERTY_TYPE_FLOAT = 'f'
 
const PROPERTY_TYPE_DATE = 'd'
 
const PROPERTY_TYPE_STRING = 's'
 
const PROPERTY_TYPE_UNKNOWN = 'u'
 

Private Member Functions

 identifyPropertyType ($propertyValue)
 

Static Private Member Functions

static intOrFloatTimestamp ($timestamp)
 
static convertProperty2 ($propertyValue, string $type)
 Convert property to form desired by Excel. More...
 

Private Attributes

const VALID_PROPERTY_TYPE_LIST
 
 $creator = 'Unknown Creator'
 
 $lastModifiedBy
 
 $created
 
 $modified
 
 $title = 'Untitled Spreadsheet'
 
 $description = ''
 
 $subject = ''
 
 $keywords = ''
 
 $category = ''
 
 $manager = ''
 
 $company = ''
 
 $customProperties = []
 
const PROPERTY_TYPE_ARRAY
 
const const SPECIAL_TYPES
 

Detailed Description

Definition at line 8 of file Properties.php.

Constructor & Destructor Documentation

◆ __construct()

PhpOffice\PhpSpreadsheet\Document\Properties::__construct ( )

Create a new Document Properties instance.

Definition at line 113 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$creator.

114  {
115  // Initialise values
116  $this->lastModifiedBy = $this->creator;
117  $this->created = self::intOrFloatTimestamp(null);
118  $this->modified = self::intOrFloatTimestamp(null);
119  }

Member Function Documentation

◆ convertProperty()

const const static PhpOffice\PhpSpreadsheet\Document\Properties::convertProperty (   $propertyValue,
string  $propertyType 
)
static

Convert property to form desired by Excel.

Parameters
mixed$propertyValue
Returns
mixed

Definition at line 500 of file Properties.php.

501  {
502  return self::SPECIAL_TYPES[$propertyType] ?? self::convertProperty2($propertyValue, $propertyType);
503  }

◆ convertProperty2()

static PhpOffice\PhpSpreadsheet\Document\Properties::convertProperty2 (   $propertyValue,
string  $type 
)
staticprivate

Convert property to form desired by Excel.

Parameters
mixed$propertyValue
Returns
mixed

Definition at line 512 of file Properties.php.

513  {
514  $propertyType = self::convertPropertyType($type);
515  switch ($propertyType) {
516  case self::PROPERTY_TYPE_INTEGER:
517  $intValue = (int) $propertyValue;
518 
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');
526  default: // includes string
527  return $propertyValue;
528  }
529  }
$type

◆ convertPropertyType()

static PhpOffice\PhpSpreadsheet\Document\Properties::convertPropertyType ( string  $propertyType)
static

Definition at line 531 of file Properties.php.

531  : string
532  {
533  return self::PROPERTY_TYPE_ARRAY[$propertyType] ?? self::PROPERTY_TYPE_UNKNOWN;
534  }

◆ getCategory()

PhpOffice\PhpSpreadsheet\Document\Properties::getCategory ( )

Get Category.

Definition at line 313 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$category.

313  : string
314  {
315  return $this->category;
316  }

◆ getCompany()

PhpOffice\PhpSpreadsheet\Document\Properties::getCompany ( )

Get Company.

Definition at line 333 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$company.

333  : string
334  {
335  return $this->company;
336  }

◆ getCreated()

PhpOffice\PhpSpreadsheet\Document\Properties::getCreated ( )

Get Created.

Returns
float|int

Definition at line 187 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$created.

◆ getCreator()

PhpOffice\PhpSpreadsheet\Document\Properties::getCreator ( )

Get Creator.

Definition at line 124 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$creator.

124  : string
125  {
126  return $this->creator;
127  }

◆ getCustomProperties()

PhpOffice\PhpSpreadsheet\Document\Properties::getCustomProperties ( )

Get a List of Custom Property Names.

Returns
string[]

Definition at line 375 of file Properties.php.

375  : array
376  {
377  return array_keys($this->customProperties);
378  }

◆ getCustomPropertyType()

PhpOffice\PhpSpreadsheet\Document\Properties::getCustomPropertyType ( string  $propertyName)

Get a Custom Property Type.

Returns
null|string

Definition at line 407 of file Properties.php.

408  {
409  return $this->customProperties[$propertyName]['type'] ?? null;
410  }

◆ getCustomPropertyValue()

PhpOffice\PhpSpreadsheet\Document\Properties::getCustomPropertyValue ( string  $propertyName)

Get a Custom Property Value.

Returns
mixed

Definition at line 393 of file Properties.php.

394  {
395  if (isset($this->customProperties[$propertyName])) {
396  return $this->customProperties[$propertyName]['value'];
397  }
398 
399  return null;
400  }

◆ getDescription()

PhpOffice\PhpSpreadsheet\Document\Properties::getDescription ( )

Get Description.

Definition at line 253 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$description.

253  : string
254  {
255  return $this->description;
256  }

◆ getKeywords()

PhpOffice\PhpSpreadsheet\Document\Properties::getKeywords ( )

Get Keywords.

Definition at line 293 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$keywords.

293  : string
294  {
295  return $this->keywords;
296  }

◆ getLastModifiedBy()

PhpOffice\PhpSpreadsheet\Document\Properties::getLastModifiedBy ( )

Get Last Modified By.

Definition at line 144 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$lastModifiedBy.

144  : string
145  {
146  return $this->lastModifiedBy;
147  }

◆ getManager()

PhpOffice\PhpSpreadsheet\Document\Properties::getManager ( )

Get Manager.

Definition at line 353 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$manager.

353  : string
354  {
355  return $this->manager;
356  }

◆ getModified()

PhpOffice\PhpSpreadsheet\Document\Properties::getModified ( )

Get Modified.

Returns
float|int

Definition at line 211 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$modified.

◆ getSubject()

PhpOffice\PhpSpreadsheet\Document\Properties::getSubject ( )

Get Subject.

Definition at line 273 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$subject.

273  : string
274  {
275  return $this->subject;
276  }

◆ getTitle()

PhpOffice\PhpSpreadsheet\Document\Properties::getTitle ( )

Get Title.

Definition at line 233 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$title.

233  : string
234  {
235  return $this->title;
236  }

◆ identifyPropertyType()

PhpOffice\PhpSpreadsheet\Document\Properties::identifyPropertyType (   $propertyValue)
private
Parameters
mixed$propertyValue

Definition at line 415 of file Properties.php.

Referenced by PhpOffice\PhpSpreadsheet\Document\Properties\setCustomProperty().

415  : string
416  {
417  if (is_float($propertyValue)) {
418  return self::PROPERTY_TYPE_FLOAT;
419  }
420  if (is_int($propertyValue)) {
421  return self::PROPERTY_TYPE_INTEGER;
422  }
423  if (is_bool($propertyValue)) {
424  return self::PROPERTY_TYPE_BOOLEAN;
425  }
426 
427  return self::PROPERTY_TYPE_STRING;
428  }
+ Here is the caller graph for this function:

◆ intOrFloatTimestamp()

static PhpOffice\PhpSpreadsheet\Document\Properties::intOrFloatTimestamp (   $timestamp)
staticprivate
Parameters
null | float | int | string$timestamp
Returns
float|int

Definition at line 166 of file Properties.php.

References $timestamp, and PhpOffice\PhpSpreadsheet\Shared\IntOrFloat\evaluate().

167  {
168  if ($timestamp === null) {
169  $timestamp = (float) (new DateTime())->format('U');
170  } elseif (is_string($timestamp)) {
171  if (is_numeric($timestamp)) {
172  $timestamp = (float) $timestamp;
173  } else {
174  $timestamp = preg_replace('/[.][0-9]*$/', '', $timestamp) ?? '';
175  $timestamp = (float) (new DateTime($timestamp))->format('U');
176  }
177  }
178 
180  }
static evaluate($value)
Help some functions with large results operate correctly on 32-bit, by returning result as int when p...
Definition: IntOrFloat.php:15
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81
+ Here is the call graph for this function:

◆ isCustomPropertySet()

PhpOffice\PhpSpreadsheet\Document\Properties::isCustomPropertySet ( string  $propertyName)

Check if a Custom Property is defined.

Definition at line 383 of file Properties.php.

383  : bool
384  {
385  return array_key_exists($propertyName, $this->customProperties);
386  }

◆ setCategory()

PhpOffice\PhpSpreadsheet\Document\Properties::setCategory ( string  $category)

Set Category.

Returns
$this

Definition at line 323 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$category.

323  : self
324  {
325  $this->category = $category;
326 
327  return $this;
328  }

◆ setCompany()

PhpOffice\PhpSpreadsheet\Document\Properties::setCompany ( string  $company)

Set Company.

Returns
$this

Definition at line 343 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$company.

343  : self
344  {
345  $this->company = $company;
346 
347  return $this;
348  }

◆ setCreated()

PhpOffice\PhpSpreadsheet\Document\Properties::setCreated (   $timestamp)

Set Created.

Parameters
null | float | int | string$timestamp
Returns
$this

Definition at line 199 of file Properties.php.

References $timestamp.

199  : self
200  {
201  $this->created = self::intOrFloatTimestamp($timestamp);
202 
203  return $this;
204  }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81

◆ setCreator()

PhpOffice\PhpSpreadsheet\Document\Properties::setCreator ( string  $creator)

Set Creator.

Returns
$this

Definition at line 134 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$creator.

134  : self
135  {
136  $this->creator = $creator;
137 
138  return $this;
139  }

◆ setCustomProperty()

PhpOffice\PhpSpreadsheet\Document\Properties::setCustomProperty ( string  $propertyName,
  $propertyValue = '',
  $propertyType = null 
)

Set a Custom Property.

Parameters
mixed$propertyValue
string$propertyType'i' : Integer 'f' : Floating Point 's' : String 'd' : Date/Time 'b' : Boolean
Returns
$this

Definition at line 443 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\identifyPropertyType().

443  : self
444  {
445  if (($propertyType === null) || (!in_array($propertyType, self::VALID_PROPERTY_TYPE_LIST))) {
446  $propertyType = $this->identifyPropertyType($propertyValue);
447  }
448 
449  if (!is_object($propertyValue)) {
450  $this->customProperties[$propertyName] = [
451  'value' => self::convertProperty($propertyValue, $propertyType),
452  'type' => $propertyType,
453  ];
454  }
455 
456  return $this;
457  }
+ Here is the call graph for this function:

◆ setDescription()

PhpOffice\PhpSpreadsheet\Document\Properties::setDescription ( string  $description)

Set Description.

Returns
$this

Definition at line 263 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$description.

263  : self
264  {
265  $this->description = $description;
266 
267  return $this;
268  }

◆ setKeywords()

PhpOffice\PhpSpreadsheet\Document\Properties::setKeywords ( string  $keywords)

Set Keywords.

Returns
$this

Definition at line 303 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$keywords.

303  : self
304  {
305  $this->keywords = $keywords;
306 
307  return $this;
308  }

◆ setLastModifiedBy()

PhpOffice\PhpSpreadsheet\Document\Properties::setLastModifiedBy ( string  $modifier)

Set Last Modified By.

Returns
$this

Definition at line 154 of file Properties.php.

154  : self
155  {
156  $this->lastModifiedBy = $modifier;
157 
158  return $this;
159  }

◆ setManager()

PhpOffice\PhpSpreadsheet\Document\Properties::setManager ( string  $manager)

Set Manager.

Returns
$this

Definition at line 363 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$manager.

363  : self
364  {
365  $this->manager = $manager;
366 
367  return $this;
368  }

◆ setModified()

PhpOffice\PhpSpreadsheet\Document\Properties::setModified (   $timestamp)

Set Modified.

Parameters
null | float | int | string$timestamp
Returns
$this

Definition at line 223 of file Properties.php.

References $timestamp.

223  : self
224  {
225  $this->modified = self::intOrFloatTimestamp($timestamp);
226 
227  return $this;
228  }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81

◆ setSubject()

PhpOffice\PhpSpreadsheet\Document\Properties::setSubject ( string  $subject)

Set Subject.

Returns
$this

Definition at line 283 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$subject.

283  : self
284  {
285  $this->subject = $subject;
286 
287  return $this;
288  }

◆ setTitle()

PhpOffice\PhpSpreadsheet\Document\Properties::setTitle ( string  $title)

Set Title.

Returns
$this

Definition at line 243 of file Properties.php.

References PhpOffice\PhpSpreadsheet\Document\Properties\$title.

243  : self
244  {
245  $this->title = $title;
246 
247  return $this;
248  }

Field Documentation

◆ $category

PhpOffice\PhpSpreadsheet\Document\Properties::$category = ''
private

◆ $company

PhpOffice\PhpSpreadsheet\Document\Properties::$company = ''
private

◆ $created

PhpOffice\PhpSpreadsheet\Document\Properties::$created
private

◆ $creator

PhpOffice\PhpSpreadsheet\Document\Properties::$creator = 'Unknown Creator'
private

◆ $customProperties

PhpOffice\PhpSpreadsheet\Document\Properties::$customProperties = []
private

Definition at line 108 of file Properties.php.

◆ $description

PhpOffice\PhpSpreadsheet\Document\Properties::$description = ''
private

◆ $keywords

PhpOffice\PhpSpreadsheet\Document\Properties::$keywords = ''
private

◆ $lastModifiedBy

PhpOffice\PhpSpreadsheet\Document\Properties::$lastModifiedBy
private

◆ $manager

PhpOffice\PhpSpreadsheet\Document\Properties::$manager = ''
private

◆ $modified

PhpOffice\PhpSpreadsheet\Document\Properties::$modified
private

◆ $subject

PhpOffice\PhpSpreadsheet\Document\Properties::$subject = ''
private

◆ $title

PhpOffice\PhpSpreadsheet\Document\Properties::$title = 'Untitled Spreadsheet'
private

◆ PROPERTY_TYPE_ARRAY

const PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_ARRAY
private
Initial value:
= [
'i' => self::PROPERTY_TYPE_INTEGER

Definition at line 459 of file Properties.php.

◆ PROPERTY_TYPE_BOOLEAN

const PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_BOOLEAN = 'b'

constants

Definition at line 11 of file Properties.php.

◆ PROPERTY_TYPE_DATE

const PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_DATE = 'd'

Definition at line 14 of file Properties.php.

◆ PROPERTY_TYPE_FLOAT

const PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_FLOAT = 'f'

Definition at line 13 of file Properties.php.

◆ PROPERTY_TYPE_INTEGER

const PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_INTEGER = 'i'

Definition at line 12 of file Properties.php.

◆ PROPERTY_TYPE_STRING

const PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_STRING = 's'

Definition at line 15 of file Properties.php.

◆ PROPERTY_TYPE_UNKNOWN

const PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_UNKNOWN = 'u'

Definition at line 16 of file Properties.php.

◆ SPECIAL_TYPES

const const PhpOffice\PhpSpreadsheet\Document\Properties::SPECIAL_TYPES
private
Initial value:
= [
'empty' => ''

Definition at line 488 of file Properties.php.

◆ VALID_PROPERTY_TYPE_LIST

const PhpOffice\PhpSpreadsheet\Document\Properties::VALID_PROPERTY_TYPE_LIST
private
Initial value:
= [
self::PROPERTY_TYPE_BOOLEAN,
self::PROPERTY_TYPE_INTEGER,
self::PROPERTY_TYPE_FLOAT,
self::PROPERTY_TYPE_DATE,
self::PROPERTY_TYPE_STRING,
]

Definition at line 18 of file Properties.php.


The documentation for this class was generated from the following file: