See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 39 and 401]
1 <?php 2 /** 3 * LICENSE 4 * 5 * This file is part of CFPropertyList. 6 * 7 * The PHP implementation of Apple's PropertyList can handle XML PropertyLists 8 * as well as binary PropertyLists. It offers functionality to easily convert 9 * data between worlds, e.g. recalculating timestamps from unix epoch to apple 10 * epoch and vice versa. A feature to automagically create (guess) the plist 11 * structure from a normal PHP data structure will help you dump your data to 12 * plist in no time. 13 * 14 * Copyright (c) 2018 Teclib' 15 * 16 * Permission is hereby granted, free of charge, to any person obtaining a copy 17 * of this software and associated documentation files (the "Software"), to deal 18 * in the Software without restriction, including without limitation the rights 19 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 * copies of the Software, and to permit persons to whom the Software is 21 * furnished to do so, subject to the following conditions: 22 * 23 * The above copyright notice and this permission notice shall be included in all 24 * copies or substantial portions of the Software. 25 * 26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 * SOFTWARE. 33 * 34 * ------------------------------------------------------------------------------ 35 * @author Rodney Rehm <rodney.rehm@medialize.de> 36 * @author Christian Kruse <cjk@wwwtech.de> 37 * @copyright Copyright © 2018 Teclib 38 * @package plist 39 * @license MIT 40 * @link https://github.com/TECLIB/CFPropertyList/ 41 * @link http://developer.apple.com/documentation/Darwin/Reference/ManPages/man5/plist.5.html Property Lists 42 * ------------------------------------------------------------------------------ 43 */ 44 45 namespace CFPropertyList; 46 47 use \DOMDocument; 48 use \Iterator; 49 use \ArrayAccess; 50 51 /** 52 *Base-Class of all CFTypes used by CFPropertyList. 53 * @example example-create-01.php Using the CFPropertyList API 54 * @example example-create-02.php Using CFPropertyList::guess() 55 * @example example-create-03.php Using CFPropertyList::guess() with {@link CFDate} and {@link CFData} 56 */ 57 abstract class CFType 58 { 59 /** 60 * CFType nodes 61 * @var array 62 */ 63 protected $value = null; 64 65 /** 66 * Create new CFType. 67 * @param mixed $value Value of CFType 68 */ 69 public function __construct($value = null) 70 { 71 $this->setValue($value); 72 } 73 74 /************************************************************************************************ 75 * M A G I C P R O P E R T I E S 76 ************************************************************************************************/ 77 78 /** 79 * Get the CFType's value 80 * @return mixed CFType's value 81 */ 82 public function getValue() 83 { 84 return $this->value; 85 } 86 87 /** 88 * Set the CFType's value 89 * @return void 90 */ 91 public function setValue($value) 92 { 93 $this->value = $value; 94 } 95 96 /************************************************************************************************ 97 * S E R I A L I Z I N G 98 ************************************************************************************************/ 99 100 /** 101 * Get XML-Node. 102 * @param DOMDocument $doc DOMDocument to create DOMNode in 103 * @param string $nodeName Name of element to create 104 * @return DOMNode Node created based on CType 105 * @uses $value as nodeValue 106 */ 107 public function toXML(DOMDocument $doc, $nodeName = "") 108 { 109 $node = $doc->createElement($nodeName); 110 $text = $doc->createTextNode($this->value); 111 $node->appendChild($text); 112 return $node; 113 } 114 115 /** 116 * convert value to binary representation 117 * @param CFBinaryPropertyList The binary property list object 118 * @return The offset in the object table 119 */ 120 abstract public function toBinary(CFBinaryPropertyList &$bplist); 121 122 /** 123 * Get CFType's value. 124 * @return mixed primitive value 125 * @uses $value for retrieving primitive of CFType 126 */ 127 public function toArray() 128 { 129 return $this->getValue(); 130 } 131 } 132 133 # eof
title
Description
Body
title
Description
Body
title
Description
Body
title
Body