1 | <?php |
||
49 | class Properties extends HashMap implements PropertiesInterface |
||
50 | { |
||
51 | |||
52 | /** |
||
53 | * This member is TRUE if the sections should be parsed, else FALSE |
||
54 | * |
||
55 | * @var boolean |
||
56 | */ |
||
57 | protected $sections = false; |
||
58 | |||
59 | /** |
||
60 | * The default constructor. |
||
61 | * |
||
62 | * @param \AppserverIo\Properties\Properties $defaults The properties we want want to use for initialization |
||
63 | */ |
||
64 | 11 | public function __construct(Properties $defaults = null) |
|
74 | |||
75 | /** |
||
76 | * Factory method. |
||
77 | * |
||
78 | * @param \AppserverIo\Properties\Properties $defaults Default properties to initialize the new ones with |
||
79 | * |
||
80 | * @return \AppserverIo\Properties\Properties The initialized properties |
||
81 | */ |
||
82 | 8 | public static function create(Properties $defaults = null) |
|
86 | |||
87 | /** |
||
88 | * Reads a property list (key and element pairs) from the passed file. |
||
89 | * |
||
90 | * @param string $file The path and the name of the file to load the properties from |
||
91 | * @param boolean $sections Has to be TRUE to parse the sections |
||
92 | * @param integer $scannerMode Can either be INI_SCANNER_NORMAL (default) or INI_SCANNER_RAW, if INI_SCANNER_RAW is supplied, then option values will not be parsed. |
||
93 | * |
||
94 | * @return \AppserverIo\Properties\Properties The initialized properties |
||
95 | * @throws \AppserverIo\Properties\PropertyFileParseException Is thrown if an error occurs while parsing the property file |
||
96 | * @throws \AppserverIo\Properties\PropertyFileNotFoundException Is thrown if the property file passed as parameter does not exist in the include path |
||
97 | * @link http://php.net/parse_ini_string |
||
98 | */ |
||
99 | 7 | public function load($file, $sections = false, $scannerMode = INI_SCANNER_RAW) |
|
120 | |||
121 | /** |
||
122 | * Stores the properties in the property file. This method is NOT using the include path for storing the file. |
||
123 | * |
||
124 | * @param string $file The path and the name of the file to store the properties to |
||
125 | * |
||
126 | * @return void |
||
127 | * |
||
128 | * @throws \AppserverIo\Properties\PropertyFileStoreException Is thrown if the file could not be written |
||
129 | * @todo Actually only properties without sections will be stored, if a section is specified, then it will be ignored |
||
|
|||
130 | */ |
||
131 | 2 | public function store($file) |
|
149 | |||
150 | /** |
||
151 | * Searches for the property with the specified key in this property list. |
||
152 | * |
||
153 | * @param string $key Holds the key of the value to return |
||
154 | * @param string $section Holds a string with the section name to return the key for (only matters if sections is set to TRUE) |
||
155 | * |
||
156 | * @return string Holds the value of the passed key |
||
157 | * @throws \AppserverIo\Lang\NullPointerException Is thrown if the passed key, or, if sections are TRUE, the passed section is NULL |
||
158 | */ |
||
159 | 6 | public function getProperty($key, $section = null) |
|
195 | |||
196 | /** |
||
197 | * Calls the HashMap method add. |
||
198 | * |
||
199 | * @param string $key Holds the key of the value to return |
||
200 | * @param mixed $value Holds the value to add to the properties |
||
201 | * @param string $section Holds a string with the section name to return the key for (only matters if sections is set to TRUE) |
||
202 | * |
||
203 | * @return void |
||
204 | * @throws \AppserverIo\Lang\NullPointerException Is thrown if the passed key, or, if sections are TRUE, the passed section is NULL |
||
205 | */ |
||
206 | 5 | public function setProperty($key, $value, $section = null) |
|
232 | |||
233 | /** |
||
234 | * Returns all properties with their keys as a string. |
||
235 | * |
||
236 | * @return string String with all key -> properties pairs |
||
237 | */ |
||
238 | public function __toString() |
||
260 | |||
261 | /** |
||
262 | * Returns all properties with their keys as a String. |
||
263 | * |
||
264 | * @return \AppserverIo\Lang\String String with all key -> properties pairs |
||
265 | */ |
||
266 | public function toString() |
||
270 | |||
271 | /** |
||
272 | * Merges the passed properties into the actual instance. If override |
||
273 | * flag is set to TRUE, existing properties will be overwritten. |
||
274 | * |
||
275 | * @param \AppserverIo\Properties\PropertiesInterface $properties The properties to merge |
||
276 | * @param boolean $override TRUE if existing properties have to be overwritten, else FALSE |
||
277 | * |
||
278 | * @return void |
||
279 | */ |
||
280 | 2 | public function mergeProperties(PropertiesInterface $properties, $override = false) |
|
289 | |||
290 | /** |
||
291 | * Returns all key values as an array. |
||
292 | * |
||
293 | * @return array The keys as array values |
||
294 | */ |
||
295 | 3 | public function getKeys() |
|
311 | } |
||
312 |
This check looks
TODO
comments that have been left in the code.``TODO``s show that something is left unfinished and should be attended to.