Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [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: 724 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.

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

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

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

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

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

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

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

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

return: void
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}

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

return: void
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}

getLibxmlErrors()   X-Ref
No description

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

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

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

return: void
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

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

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

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

return: void
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

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

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

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

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

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

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

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

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

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

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

purge()   X-Ref
Empty the collection

return: array the removed CFTypes

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

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

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.

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

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: CFType current Item

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

return: string 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