Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403]

LICENSE This file is part of CFPropertyList.

Author: Rodney Rehm <rodney.rehm@medialize.de>
Author: Christian Kruse <cjk@wwwtech.de>
Copyright: Copyright © 2018 Teclib
License: MIT
File Size: 726 lines (25 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

CFPropertyList:: (26 methods):
  __construct()
  loadXML()
  loadXMLStream()
  loadBinary()
  loadBinaryStream()
  load()
  parse()
  getLibxmlErrors()
  import()
  saveXML()
  saveBinary()
  save()
  toXML()
  add()
  get()
  __get()
  del()
  purge()
  getValue()
  guess()
  toArray()
  rewind()
  current()
  key()
  next()
  valid()


Class: CFPropertyList  - X-Ref

Property List
Interface for handling reading, editing and saving Property Lists as defined by Apple.

__construct($file = null, $format = self::FORMAT_AUTO)   X-Ref
Create new CFPropertyList.
If a path to a PropertyList is specified, it is loaded automatically.

param: string $file Path of PropertyList
param: integer $format he format of the property list, see {@link FORMAT_XML}, {@link FORMAT_BINARY} and {@link FORMAT_AUTO}, defaults to {@link FORMAT_AUTO}

loadXML($file = null)   X-Ref
Load an XML PropertyList.

param: string $file Path of PropertyList, defaults to {@link $file}
return: void

loadXMLStream($stream)   X-Ref
Load an XML PropertyList.

param: resource $stream A stream containing the xml document.
return: void

loadBinary($file = null)   X-Ref
Load an binary PropertyList.

param: string $file Path of PropertyList, defaults to {@link $file}
return: void

loadBinaryStream($stream)   X-Ref
Load an binary PropertyList.

param: stream $stream Stream containing the PropertyList
return: void

load($file = null, $format = null)   X-Ref
Load a plist file.
Load and import a plist file.

param: string $file Path of PropertyList, defaults to {@link $file}
param: integer $format The format of the property list, see {@link FORMAT_XML}, {@link FORMAT_BINARY} and {@link FORMAT_AUTO}, defaults to {@link $format}
return: void

parse($str = null, $format = null)   X-Ref
Parse a plist string.
Parse and import a plist string.

param: string $str String containing the PropertyList, defaults to {@link $content}
param: integer $format The format of the property list, see {@link FORMAT_XML}, {@link FORMAT_BINARY} and {@link FORMAT_AUTO}, defaults to {@link $format}
return: void

getLibxmlErrors()   X-Ref
No description

import(DOMNode $node, $parent)   X-Ref
Convert a DOMNode into a CFType.

param: DOMNode $node Node to import children of
param: CFDictionary|CFArray|CFPropertyList $parent
return: void

saveXML($file, $formatted = false)   X-Ref
Convert CFPropertyList to XML and save to file.

param: string $file Path of PropertyList, defaults to {@link $file}
param: bool $formatted Print plist formatted (i.e. with newlines and whitespace indention) if true; defaults to false
return: void

saveBinary($file)   X-Ref
Convert CFPropertyList to binary format (bplist00) and save to file.

param: string $file Path of PropertyList, defaults to {@link $file}
return: void

save($file = null, $format = null, $formatted_xml = false)   X-Ref
Convert CFPropertyList to XML or binary and save to file.

param: string $file Path of PropertyList, defaults to {@link $file}
param: string $format Format of PropertyList, defaults to {@link $format}
param: bool $formatted_xml Print XML plist formatted (i.e. with newlines and whitespace indention) if true; defaults to false
return: void

toXML($formatted = false)   X-Ref
Convert CFPropertyList to XML

param: bool $formatted Print plist formatted (i.e. with newlines and whitespace indention) if true; defaults to false
return: string The XML content

add(CFType $value = null)   X-Ref
Add CFType to collection.

param: CFType $value CFType to add to collection
return: void

get($key)   X-Ref
Get CFType from collection.

param: integer $key Key of CFType to retrieve from collection
return: CFType CFType found at $key, null else

__get($key)   X-Ref
Generic getter (magic)

param: integer $key Key of CFType to retrieve from collection
author: Sean Coates <sean@php.net>
return: CFType CFType found at $key, null else

del($key)   X-Ref
Remove CFType from collection.

param: integer $key Key of CFType to removes from collection
return: CFType removed CFType, null else

purge()   X-Ref
Empty the collection

return: array the removed CFTypes

getValue($cftype = false)   X-Ref
Get first (and only) child, or complete collection.

param: boolean $cftype if set to true returned value will be CFArray instead of an array in case of a collection
return: CFType|array CFType or list of CFTypes known to the PropertyList

guess($value, $options = array()   X-Ref
Create CFType-structure from guessing the data-types.
The functionality has been moved to the more flexible {@link CFTypeDetector} facility.

param: mixed $value Value to convert to CFType
param: array $options Configuration for casting values [autoDictionary, suppressExceptions, objectToArrayMethod, castNumericStrings]
return: CFType CFType based on guessed type

toArray()   X-Ref
Get PropertyList as array.

return: mixed primitive value of first (and only) CFType, or array of primitive values of collection

rewind()   X-Ref
Rewind {@link $iteratorPosition} to first position (being 0)

return: void

current()   X-Ref
Get Iterator's current {@link CFType} identified by {@link $iteratorPosition}

return: mixed current Item

key()   X-Ref
Get Iterator's current key identified by {@link $iteratorPosition}

return: mixed key of the current Item

next()   X-Ref
Increment {@link $iteratorPosition} to address next {@see CFType}

return: void

valid()   X-Ref
Test if {@link $iteratorPosition} addresses a valid element of {@link $value}

return: boolean true if current position is valid, false else