xref: /PHP-5.3/ext/spl/spl.php (revision e48d79ba)
1<?php
2
3/** @file spl.php
4 * @ingroup SPL
5 * @brief Documentation of internal classes and interfaces
6 *
7 * SPL - Standard PHP Library
8 *
9 * (c) Marcus Boerger, 2003 - 2008
10 */
11
12/** @mainpage SPL - Standard PHP Library
13 *
14 * SPL - Standard PHP Library
15 *
16 * SPL is a collection of interfaces and classes that are meant to solve
17 * standard problems and implements some efficient data access interfaces
18 * and classes. You'll find the classes documented using php code in the
19 * file spl.php or in corresponding .inc files in subdirectories examples
20 * and internal. Based on the internal implementations or the files in the
21 * examples subdirectory there are also some .php files to experiment with.
22 *
23 * The .inc files are not included automatically because they are sooner or
24 * later integrated into the extension. That means that you either need to
25 * put the code of examples/autoload.inc into your autoprepend file or that
26 * you have to point your ini setting auto_prepend_file to that file.
27 *
28 * Below is a list of interfaces/classes already availabel natively through
29 * the SPL extension grouped by category.
30 *
31 * 1) Iterators
32 *
33 * SPL offers some advanced iterator algorithms:
34 *
35 * - interface RecursiveIterator extends Iterator
36 * - interface OuterIterator extends Iterator
37 * - class RecursiveIteratorIterator implements OuterIterator
38 * - class RecursiveTreeIterator extends RecursiveIteratorIterator
39 * - abstract class FilterIterator implements OuterIterator
40 * - class ParentIterator extends FilterIterator implements RecursiveIterator
41 * - interface SeekableIterator extends Iterator
42 * - class LimitIterator implements OuterIterator
43 * - class CachingIterator implements OuterIterator
44 * - class RecursiveCachingIterator extends CachingIterator implements RecursiveIterator
45 * - class IteratorIterator implements OuterIterator
46 * - class NoRewindIterator implements OuterIterator
47 * - class EmptyIterator implements Iterator
48 * - class InfiniteIterator extends IteratorIterator
49 * - class AppendIterator implements OuterIterator
50 * - class RegexIterator extends FilterIterator
51 * - class RecursiveRegexIterator extends RegexIterator implements RecursiveIterator
52 * - class MultipleIterator extends Iterator
53 *
54 * 2) Directories and Files
55 *
56 * SPL offers two advanced directory and file handling classes:
57 *
58 * - class SplFileInfo
59 * - class DirectoryIterator extends SplFileInfo implements Iterator
60 * - class FilesystemIterator extends DirectoryIterator
61 * - class RecursiveDirectoryIterator extends FilesystemIterator implements RecursiveIterator
62 * - class GlobIterator extends FilesystemIterator implements Countable
63 * - class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIterator
64 * - class SplTempFileObject extends SplFileObject
65 *
66 * 3) XML
67 *
68 * SPL offers an advanced XML handling class:
69 *
70 * - class SimpleXMLIterator extends simplexml_element implements RecursiveIterator
71 *
72 * 4) Array Overloading
73 *
74 * SPL offers advanced Array overloading:
75 *
76 * - class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
77 * - class ArrayIterator implements Iterator, ArrayAccess, Countable, SeekableIterator
78 * - class RecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
79 * - class SplFixedArray implements Iterator, ArrayAccess, Countable
80 *
81 * As the above suggest an ArrayObject creates an ArrayIterator when it comes to
82 * iteration (e.g. ArrayObject instance used inside foreach).
83 *
84 * 5) Counting
85 *
86 * - interface Countable allows to hook into the standard array function count().
87 *
88 * 6) Exception%s
89 *
90 * SPL provides a set of standard Exception classes each meant to indicate a
91 * certain problem type.
92 *
93 * - class LogicException           extends Exception
94 * - class BadFunctionCallException extends LogicException
95 * - class BadMethodCallException   extends BadFunctionCallException
96 * - class DomainException          extends LogicException
97 * - class InvalidArgumentException extends LogicException
98 * - class LengthException          extends LogicException
99 * - class OutOfRangeException      extends LogicException
100 * - class RuntimeException         extends Exception
101 * - class OutOfBoundsException     extends RuntimeException
102 * - class OverflowException        extends RuntimeException
103 * - class RangeException           extends RuntimeException
104 * - class UnderflowException       extends RuntimeException
105 *
106 * 7) Observer
107 *
108 * SPL suggests a standard way of implementing the observer pattern.
109 *
110 * - interface SplObserver
111 * - interface SplSubject
112 * - class SplObjectStorage
113 *
114 * 8) Datastructures
115 *
116 * SPL proposes a set of datastructures implemented internally.
117 *
118 * - class SplDoublyLinkedList
119 * - class SplStack                 extends SplDoublyLinkedList
120 * - class SplQueue                 extends SplDoublyLinkedList
121 *
122 * 9) @ref Examples
123 *
124 * The classes and interfaces in this group are contained as PHP code in the
125 * examples subdirectory of ext/SPL. Sooner or later they will be moved to
126 * c-code.
127 *
128 * 10) Some articles about SPL:
129 * - <a href="http://www.phpro.org/tutorials/Introduction-to-SPL.html">Introduction to Standard PHP Library (SPL)</a>
130 * - <a href="http://www.sitepoint.com/article/php5-standard-library/1">Introducing PHP 5's Standard Library</a>
131 * - <a href="http://www.ramikayyali.com/archives/2005/02/25/iterators">Iterators in PHP5</a>
132 * - <a href="http://www.phpriot.com/d/articles/php/oop/oop-with-spl-php-5-1/index.html">Advanced OOP with SPL in PHP 5</a>
133 * - <a href="http://www.devshed.com/c/a/PHP/The-Standard-PHP-Library-Part-1/">The Standard PHP Library, Part 1</a>
134 * - <a href="http://www.devshed.com/c/a/PHP/The-Standard-PHP-Library-Part-2/">The Standard PHP Library, Part 2</a>
135 * - <a href="http://www.professionelle-softwareentwicklung-mit-php5.de/erste_auflage/oop.iterators.spl.html">Die Standard PHP Library (SPL) [german]</a>
136 *
137 * 11) Talks on SPL:
138 * - SPL Update <a href="http://talks.somabo.de/200702_vancouver_spl_update.pps">[pps]</a>, <a href="http://talks.somabo.de/200702_vancouver_spl_update.pdf">[pdf]</a>
139 * - Happy SPLing <a href="http://talks.somabo.de/200509_toronto_happy_spling.pps">[pps]</a>, <a href="http://talks.somabo.de/200509_toronto_happy_spling.pdf">[pdf]</a>
140 * - From engine overloading to SPL <a href="http://talks.somabo.de/200505_cancun_from_engine_overloading_to_spl.pps">[pps]</a>, <a href="http://talks.somabo.de/200505_cancun_from_engine_overloading_to_spl.pdf">[pdf]</a>
141 * - SPL for the masses <a href="http://talks.somabo.de/200504_php_quebec_spl_for_the_masses.pps">[pps]</a>, <a href="http://talks.somabo.de/200504_php_quebec_spl_for_the_masses.pdf">[pdf]</a>
142 *
143 * 12) Debug sessions:
144 * - Debug session 1 <a href="200407_oscon_introduction_to_iterators_debug.pps">[pps]</a>, <a href="200407_oscon_introduction_to_iterators_debug.pdf">[pdf]</a>
145 * - Debug session 2 <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_1.pps">[pps]</a>, <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_1.pdf">[pdf]</a>, <a href="http://taks.somabo.de/200411_php_conference_frankfrurt_iterator_debug_session.swf">[swf]</a>
146 * - Debug session 3 <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_2.pps">[pps]</a>, <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_2.pdf">[pdf]</a>
147 *
148 * You can download this documentation as a chm file
149 * <a href="http://php.net/~helly/php/ext/spl/spl.chm">here</a>.
150 *
151 * (c) Marcus Boerger, 2003 - 2007
152 */
153
154/** @defgroup ZendEngine Zend engine classes
155 *
156 * The classes and interfaces in this group are contained in the c-code of
157 * PHP's Zend engine.
158 */
159
160/** @defgroup SPL Internal classes
161 *
162 * The classes and interfaces in this group are contained in the c-code of
163 * ext/SPL.
164 */
165
166/** @defgroup Examples Example classes
167 *
168 * The classes and interfaces in this group are contained as PHP code in the
169 * examples subdirectory of ext/SPL. Sooner or later they will be moved to
170 * c-code.
171 */
172
173/** @ingroup SPL
174 * @brief Default implementation for __autoload()
175 * @since PHP 5.1
176 *
177 * @param class_name        name of class to load
178 * @param file_extensions   file extensions (use defaults if NULL)
179 */
180function spl_autoload(string $class_name, string $file_extensions = NULL) {/**/};
181
182/** @ingroup SPL
183 * @brief Manual invocation of all registerd autoload functions
184 * @since PHP 5.1
185 *
186 * @param class_name        name of class to load
187 */
188function spl_autoload_call(string $class_name) {/**/};
189
190/** @ingroup SPL
191 * @brief Register and return default file extensions for spl_autoload
192 * @since PHP 5.1
193 *
194 * @param file_extensions optional comma separated list of extensions to use in
195 *        default autoload function. If not given just return the current list.
196 * @return comma separated list of file extensions to use in default autoload
197 *        function.
198 */
199function spl_autoload_extensions($file_extensions) {/**/};
200
201/** @ingroup SPL
202 * @brief Return all registered autoload functionns
203 * @since PHP 5.1
204 *
205 * @return array of all registered autoload functions or false
206 */
207function spl_autoload_functions() {/**/};
208
209/** @ingroup SPL
210 * @brief Register given function as autoload implementation
211 * @since PHP 5.1
212 *
213 * @param autoload_function  name of function or array of object/class and
214 *                           function name to register as autoload function.
215 * @param throw              whether to throw or issue an error on failure.
216 */
217function spl_autoload_register(string $autoload_function = "spl_autoload", $throw = true) {/**/};
218
219/** @ingroup SPL
220 * @brief Unregister given function as autoload implementation
221 * @since PHP 5.1
222 *
223 * @param autoload_function  name of function or array of object/class and
224 *                           function name to unregister as autoload function.
225 */
226function spl_autoload_unregister(string $autoload_function = "spl_autoload") {/**/};
227
228/** @ingroup SPL
229 * @brief Return an array of classes and interfaces in SPL
230 *
231 * @return array containing the names of all clsses and interfaces defined in
232 *         extension SPL
233 */
234function spl_classes() {/**/};
235
236/** @ingroup SPL
237 * @brief Count the elements in an iterator
238 * @since PHP 5.1
239 *
240 * @return number of elements in an iterator
241 */
242function iterator_count(Traversable $it) {/**/};
243
244/** @ingroup SPL
245 * @brief Copy iterator elements into an array
246 * @since PHP 5.1
247 *
248 * @param it  iterator to copy
249 * @param use_keys whether touse the keys
250 * @return array with elements copied from the iterator
251 */
252function iterator_to_array(Traversable $it, $use_keys = true) {/**/};
253
254/** @ingroup ZendEngine
255 * @brief Basic Exception class.
256 * @since PHP 5.0
257 */
258class Exception
259{
260	/** The exception message */
261	protected $message;
262
263	/** The string represenations as generated during construction */
264	private $string;
265
266	/** The code passed to the constructor */
267	protected $code;
268
269	/** The file name where the exception was instantiated */
270	protected $file;
271
272	/** The line number where the exception was instantiated */
273	protected $line;
274
275	/** The stack trace */
276	private $trace;
277
278	/** Prevent clone
279	 */
280	final private function __clone() {}
281
282	/** Construct an exception
283	 *
284	 * @param $message Some text describing the exception
285	 * @param $code    Some code describing the exception
286	 */
287	function __construct($message = NULL, $code = 0) {
288		if (func_num_args()) {
289			$this->message = $message;
290		}
291		$this->code = $code;
292		$this->file = __FILE__; // of throw clause
293		$this->line = __LINE__; // of throw clause
294		$this->trace = debug_backtrace();
295		$this->string = StringFormat($this);
296	}
297
298	/** @return the message passed to the constructor
299	 */
300	final public function getMessage()
301	{
302		return $this->message;
303	}
304
305	/** @return the code passed to the constructor
306	 */
307	final public function getCode()
308	{
309		return $this->code;
310	}
311
312	/** @return the name of the file where the exception was thrown
313	 */
314	final public function getFile()
315	{
316		return $this->file;
317	}
318
319	/** @return the line number where the exception was thrown
320	 */
321	final public function getLine()
322	{
323		return $this->line;
324	}
325
326	/** @return the stack trace as array
327	 */
328	final public function getTrace()
329	{
330		return $this->trace;
331	}
332
333	/** @return the stack trace as string
334	 */
335	final public function getTraceAsString()
336	{
337	}
338
339	/** @return string represenation of exception
340	 */
341	public function __toString()
342	{
343		return $this->string;
344	}
345}
346
347/** @ingroup SPL
348 * @brief Exception that represents error in the program logic.
349 * @since PHP 5.1
350 *
351 * This kind of exceptions should directly leed to a fix in your code.
352 */
353class LogicException extends Exception
354{
355}
356
357/** @ingroup SPL
358 * @brief Exception thrown when a function call was illegal.
359 * @since PHP 5.1
360 */
361class BadFunctionCallException extends LogicException
362{
363}
364
365/** @ingroup SPL
366 * @brief Exception thrown when a method call was illegal.
367 * @since PHP 5.1
368 */
369class BadMethodCallException extends BadFunctionCallException
370{
371}
372
373/** @ingroup SPL
374 * @brief Exception that denotes a value not in the valid domain was used.
375 * @since PHP 5.1
376 *
377 * This kind of exception should be used to inform about domain erors in
378 * mathematical sense.
379 *
380 * @see RangeException
381 */
382class DomainException extends LogicException
383{
384}
385
386/** @ingroup SPL
387 * @brief Exception that denotes invalid arguments were passed.
388 * @since PHP 5.1
389 *
390 * @see UnexpectedValueException
391 */
392class InvalidArgumentException extends LogicException
393{
394}
395
396/** @ingroup SPL
397 * @brief Exception thrown when a parameter exceeds the allowed length.
398 * @since PHP 5.1
399 *
400 * This can be used for strings length, array size, file size, number of
401 * elements read from an Iterator and so on.
402 */
403class LengthException extends LogicException
404{
405}
406
407/** @ingroup SPL
408 * @brief Exception thrown when an illegal index was requested.
409 * @since PHP 5.1
410 *
411 * This represents errors that should be detected at compile time.
412 *
413 * @see OutOfBoundsException
414 */
415class OutOfRangeException extends LogicException
416{
417}
418
419/** @ingroup SPL
420 * @brief Exception thrown for errors that are only detectable at runtime.
421 * @since PHP 5.1
422 */
423class RuntimeException extends Exception
424{
425}
426
427/** @ingroup SPL
428 * @brief Exception thrown when an illegal index was requested.
429 * @since PHP 5.1
430 *
431 * This represents errors that cannot be detected at compile time.
432 *
433 * @see OutOfRangeException
434 */
435class OutOfBoundsException extends RuntimeException
436{
437}
438
439/** @ingroup SPL
440 * @brief Exception thrown to indicate arithmetic/buffer overflow.
441 * @since PHP 5.1
442 */
443class OverflowException extends RuntimeException
444{
445}
446
447/** @ingroup SPL
448 * @brief Exception thrown to indicate range errors during program execution.
449 * @since PHP 5.1
450 *
451 * Normally this means there was an arithmetic error other than under/overflow.
452 * This is the runtime version of DomainException.
453 *
454 * @see DomainException
455 */
456class RangeException extends RuntimeException
457{
458}
459
460/** @ingroup SPL
461 * @brief Exception thrown to indicate arithmetic/buffer underflow.
462 * @since PHP 5.1
463 */
464class UnderflowException extends RuntimeException
465{
466}
467
468/** @ingroup SPL
469 * @brief Exception thrown to indicate an unexpected value.
470 * @since PHP 5.1
471 *
472 * Typically this happens when a function calls another function and espects
473 * the return value to be of a certain type or value not including arithmetic
474 * or buffer related errors.
475 *
476 * @see InvalidArgumentException
477 */
478class UnexpectedValueException extends RuntimeException
479{
480}
481
482/** @ingroup ZendEngine
483 * @brief Interface to override array access of objects.
484 * @since PHP 5.0
485 */
486interface ArrayAccess
487{
488	/** @param $offset to modify
489	 * @param $value new value
490	 */
491	function offsetSet($offset, $value);
492
493	/** @param $offset to retrieve
494	 * @return value at given offset
495	 */
496	function offsetGet($offset);
497
498	/** @param $offset to delete
499	 */
500	function offsetUnset($offset);
501
502	/** @param $offset to check
503	 * @return whether the offset exists.
504	 */
505	function offsetExists($offset);
506}
507
508/** @ingroup ZendEngine
509 * @brief Interface to detect a class is traversable using foreach.
510 * @since PHP 5.0
511 *
512 * Abstract base interface that cannot be implemented alone. Instead it
513 * must be implemented by either IteratorAggregate or Iterator.
514 *
515 * @note Internal classes that implement this interface can be used in a
516 * foreach construct and do not need to implement IteratorAggregate or
517 * Iterator.
518 *
519 * @note This is an engine internal interface which cannot be implemented
520 * in PHP scripts. Either IteratorAggregate or Iterator must be used
521 * instead.
522 */
523interface Traversable
524{
525}
526
527/** @ingroup ZendEngine
528 * @brief Interface to create an external Iterator.
529 * @since PHP 5.0
530 *
531 * @note This is an engine internal interface.
532 */
533interface IteratorAggregate extends Traversable
534{
535	/** @return an Iterator for the implementing object.
536	 */
537	function getIterator();
538}
539
540/** @ingroup ZendEngine
541 * @brief Basic iterator
542 * @since PHP 5.0
543 *
544 * Interface for external iterators or objects that can be iterated
545 * themselves internally.
546 *
547 * @note This is an engine internal interface.
548 */
549interface Iterator extends Traversable
550{
551	/** Rewind the Iterator to the first element.
552	 */
553	function rewind();
554
555	/** Return the current element.
556	 */
557	function current();
558
559	/** Return the key of the current element.
560	 */
561	function key();
562
563	/** Move forward to next element.
564	 */
565	function next();
566
567	/** Check if there is a current element after calls to rewind() or next().
568	 */
569	function valid();
570}
571
572/** @ingroup SPL
573 * @brief This Interface allows to hook into the global count() function.
574 * @since PHP 5.1
575 */
576interface Countable
577{
578	/** @return the number the global function count() should show
579	 */
580	function count();
581}
582
583/** @ingroup ZendEngine
584 * @brief Interface for customized serializing
585 * @since 5.1
586 *
587 * Classes that implement this interface no longer support __sleep() and
588 * __wakeup(). The method serialized is called whenever an instance needs to
589 * be serialized. This does not invoke __destruct() or has any other side
590 * effect unless programmed inside the method. When the data is unserialized
591 * the class is known and the appropriate unserialize() method is called as a
592 * constructor instead of calling __construct(). If you need to execute the
593 * standard constructor you may do so in the method.
594 */
595interface Serializable
596{
597	/**
598	 * @return string representation of the instance
599	 */
600	function serialize();
601
602	/**
603	 * @note This is a constructor
604	 *
605	 * @param $serialized data read from stream to construct the instance
606	 */
607	function unserialize($serialized);
608}
609
610/** @ingroup SPL
611 * @brief An Array wrapper
612 * @since PHP 5.0
613 * @version 1.2
614 *
615 * This array wrapper allows to recursively iterate over Arrays and public
616 * Object properties.
617 *
618 * @see ArrayIterator
619 */
620class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
621{
622	/** Properties of the object have their normal functionality
623	 * when accessed as list (var_dump, foreach, etc.) */
624	const STD_PROP_LIST     = 0x00000001;
625	/** Array indices can be accessed as properties in read/write */
626	const ARRAY_AS_PROPS    = 0x00000002;
627
628	/** Construct a new array iterator from anything that has a hash table.
629	 * That is any Array or Object.
630	 *
631	 * @param $array the array to use.
632	 * @param $flags see setFlags().
633	 * @param $iterator_class class used in getIterator()
634	 */
635	function __construct($array, $flags = 0, $iterator_class = "ArrayIterator") {/**/}
636
637	/** Set behavior flags.
638	 *
639	 * @param $flags bitmask as follows:
640	 *        0 set: properties of the object have their normal functionality
641	 *               when accessed as list (var_dump, foreach, etc.)
642	 *        1 set: array indices can be accessed as properties in read/write
643	 */
644	function setFlags($flags) {/**/}
645
646	/** @return current flags
647	 */
648	function getFlags() {/**/}
649
650	/** Sort the entries by values.
651	 */
652	function asort() {/**/}
653
654	/** Sort the entries by key.
655	 */
656	function ksort() {/**/}
657
658	/** Sort the entries by values using user defined function.
659	 */
660	function uasort(mixed cmp_function) {/**/}
661
662	/** Sort the entries by key using user defined function.
663	 */
664	function uksort(mixed cmp_function) {/**/}
665
666	/** Sort the entries by values using "natural order" algorithm.
667	 */
668	function natsort() {/**/}
669
670	/** Sort the entries by values using case insensitive "natural order" algorithm.
671	 */
672	function natcasesort() {/**/}
673
674	/** @param $array new array or object
675	 */
676	function exchangeArray($array) {/**/}
677
678	/** @return the iterator which is an ArrayIterator object connected to
679	 * this object.
680	 */
681	function getIterator() {/**/}
682
683	/** @param $index offset to inspect
684	 * @return whetehr offset $index esists
685	 */
686	function offsetExists($index) {/**/}
687
688	/** @param $index offset to return value for
689	 * @return value at offset $index
690	 */
691	function offsetGet($index) {/**/}
692
693	/** @param $index index to set
694	 * @param $newval new value to store at offset $index
695	 */
696	function offsetSet($index, $newval) {/**/}
697
698	/** @param $index offset to unset
699	 */
700	function offsetUnset($index) {/**/}
701
702	/** @param $value is appended as last element
703	 * @warning this method cannot be called when the ArrayObject refers to
704	 *          an object.
705	 */
706	function append($value) {/**/}
707
708	/** @return a \b copy of the array
709	 * @note when the ArrayObject refers to an object then this method
710	 *       returns an array of the public properties.
711	 */
712	function getArrayCopy() {/**/}
713
714	/** @return the number of elements in the array or the number of public
715	 * properties in the object.
716	 */
717	function count() {/**/}
718
719	/* @param $iterator_class new class used in getIterator()
720	 */
721	function setIteratorClass($itertor_class) {/**/}
722
723	/* @return class used in getIterator()
724	 */
725	function getIteratorClass() {/**/}
726}
727
728/** @ingroup SPL
729 * @brief An Array iterator
730 * @since PHP 5.0
731 * @version 1.2
732 *
733 * This iterator allows to unset and modify values and keys while iterating
734 * over Arrays and Objects.
735 *
736 * When you want to iterate over the same array multiple times you need to
737 * instanciate ArrayObject and let it create ArrayIterator instances that
738 * refer to it either by using foreach or by calling its getIterator()
739 * method manually.
740 */
741class ArrayIterator implements SeekableIterator, ArrayAccess, Countable
742{
743	/** Properties of the object have their normal functionality
744	 * when accessed as list (var_dump, foreach, etc.) */
745	const STD_PROP_LIST  = 0x00000001;
746	/** Array indices can be accessed as properties in read/write */
747	const ARRAY_AS_PROPS = 0x00000002;
748
749	/** Construct a new array iterator from anything that has a hash table.
750	 * That is any Array or Object.
751	 *
752	 * @param $array the array to use.
753	 * @param $flags see setFlags().
754	 */
755	function __construct($array, $flags = 0) {/**/}
756
757	/** Set behavior flags.
758	 *
759	 * @param $flags bitmask as follows:
760	 *        0 set: properties of the object have their normal functionality
761	 *               when accessed as list (var_dump, foreach, etc.)
762	 *        1 set: array indices can be accessed as properties in read/write
763	 */
764	function setFlags($flags) {/**/}
765
766	/**
767	 * @return current flags
768	 */
769	function getFlags() {/**/}
770
771	/** Sort the entries by values.
772	 */
773	function asort() {/**/}
774
775	/** Sort the entries by key.
776	 */
777	function ksort() {/**/}
778
779	/** Sort the entries by values using user defined function.
780	 */
781	function uasort(mixed cmp_function) {/**/}
782
783	/** Sort the entries by key using user defined function.
784	 */
785	function uksort(mixed cmp_function) {/**/}
786
787	/** Sort the entries by values using "natural order" algorithm.
788	 */
789	function natsort() {/**/}
790
791	/** Sort the entries by values using case insensitive "natural order" algorithm.
792	 */
793	function natcasesort() {/**/}
794
795	/** @param $index offset to inspect
796	 * @return whetehr offset $index esists
797	 */
798	function offsetExists($index) {/**/}
799
800	/** @param $index offset to return value for
801	 * @return value at offset $index
802	 */
803	function offsetGet($index) {/**/}
804
805	/** @param $index index to set
806	 * @param $newval new value to store at offset $index
807	 */
808	function offsetSet($index, $newval) {/**/}
809
810	/** @param $index offset to unset
811	 */
812	function offsetUnset($index) {/**/}
813
814	/** @param $value is appended as last element
815	 * @warning this method cannot be called when the ArrayIterator refers to
816	 *          an object.
817	 */
818	function append($value) {/**/}
819
820	/** @return a \b copy of the array
821	 * @note when the ArrayIterator refers to an object then this method
822	 *       returns an array of the public properties.
823	 */
824	function getArrayCopy() {/**/}
825
826	/** @param $position offset to seek to
827	 * @throw OutOfBoundsException if $position is invalid
828	 */
829	function seek($position) {/**/}
830
831	/** @return the number of elements in the array or the number of public
832	 * properties in the object.
833	 */
834	function count() {/**/}
835
836	/** @copydoc Iterator::rewind */
837	function rewind() {/**/}
838
839	/** @copydoc Iterator::valid */
840	function valid() {/**/}
841
842	/** @copydoc Iterator::current */
843	function current() {/**/}
844
845	/** @copydoc Iterator::key */
846	function key() {/**/}
847
848	/** @copydoc Iterator::next */
849	function next() {/**/}
850}
851
852/** @ingroup SPL
853 * @brief File info class
854 * @since PHP 5.1.3
855 */
856class SplFileInfo
857{
858	/** Construct a file info object
859	 *
860	 * @param $file_name path or file name
861	 */
862	function __construct($file_name) {/**/}
863
864	/** @return the path part only.
865	 */
866	function getPath() {/**/}
867
868	/** @return the filename only.
869	 */
870	function getFilename() {/**/}
871
872	/** @return SplFileInfo created for the file
873	 * @param class_name name of class to instantiate
874	 * @see SplFileInfo::setInfoClass()
875	 */
876	function getFileInfo(string class_name = NULL) {/**/}
877
878	/** @return The current entries path and file name.
879	 */
880	function getPathname() {/**/}
881
882	/** @return SplFileInfo created for the path
883	 * @param class_name name of class to instantiate
884	 * @see SplFileInfo::setInfoClass()
885	 */
886	function getPathInfo(string class_name = NULL) {/**/}
887
888	/** @return The current entry's permissions.
889	 */
890	function getPerms() {/**/}
891
892	/** @return The current entry's inode.
893	 */
894	function getInode() {/**/}
895
896	/** @return The current entry's size in bytes .
897	 */
898	function getSize() {/**/}
899
900	/** @return The current entry's owner name.
901	 */
902	function getOwner() {/**/}
903
904	/** @return The current entry's group name.
905	 */
906	function getGroup() {/**/}
907
908	/** @return The current entry's last access time.
909	 */
910	function getATime() {/**/}
911
912	/** @return The current entry's last modification time.
913	 */
914	function getMTime() {/**/}
915
916	/** @return The current entry's last change time.
917	 */
918	function getCTime() {/**/}
919
920	/** @return The current entry's file type.
921	 */
922	function getType() {/**/}
923
924	/** @return Whether the current entry is writeable.
925	 */
926	function isWritable() {/**/}
927
928	/** @return Whether the current entry is readable.
929	 */
930	function isReadable() {/**/}
931
932	/** @return Whether the current entry is executable.
933	 */
934	function isExecutable() {/**/}
935
936	/** @return Whether the current entry is .
937	 */
938	function isFile() {/**/}
939
940	/** @return Whether the current entry is a directory.
941	 */
942	function isDir() {/**/}
943
944	/** @return whether the current entry is a link.
945	 */
946	function isLink() {/**/}
947
948	/** @return target of link.
949	 */
950	function getLinkTarget() {/**/}
951
952	/** @return The resolved path
953	 */
954	function getRealPath() {/**/}
955
956	/** @return getPathname()
957	 */
958	function __toString() {/**/}
959
960	/** Open the current file as a SplFileObject instance
961	 *
962	 * @param mode              open mode
963	 * @param use_include_path  whether to search include paths (don't use)
964	 * @param context           resource context to pased to open function
965	 * @throw RuntimeException  if file cannot be opened (e.g. insufficient
966	 *                          access rights).
967	 * @return The opened file as a SplFileObject instance
968	 *
969	 * @see SplFileObject
970	 * @see SplFileInfo::setFileClass()
971	 * @see file()
972	 */
973	function openFile($mode = 'r', $use_include_path = false, $context = NULL) {/**/}
974
975	/** @param class_name name of class used with openFile(). Must be derived
976	 * from SPLFileObject.
977	 */
978	function setFileClass(string class_name = "SplFileObject") {/**/}
979
980	/** @param class_name name of class used with getFileInfo(), getPathInfo().
981	 *                     Must be derived from SplFileInfo.
982	 */
983	function setInfoClass(string class_name = "SplFileInfo") {/**/}
984}
985
986/** @ingroup SPL
987 * @brief Directory iterator
988 * @version 1.1
989 * @since PHP 5.0
990 */
991class DirectoryIterator extends SplFileInfo implements Iterator
992{
993	/** Construct a directory iterator from a path-string.
994	 *
995	 * @param $path directory to iterate.
996	 */
997	function __construct($path) {/**/}
998
999	/** @copydoc Iterator::rewind */
1000	function rewind() {/**/}
1001
1002	/** @copydoc Iterator::valid */
1003	function valid() {/**/}
1004
1005	/** @return index of entry
1006	 */
1007	function key() {/**/}
1008
1009	/** @return $this
1010	 */
1011	function current() {/**/}
1012
1013	/** @copydoc Iterator::next */
1014	function next() {/**/}
1015
1016	/** @return Whether the current entry is either '.' or '..'.
1017	 */
1018	function isDot() {/**/}
1019
1020	/** @return whether the current entry is a link.
1021	 */
1022	function isLink() {/**/}
1023
1024	/** @return getFilename()
1025	 */
1026	function __toString() {/**/}
1027}
1028
1029/** @ingroup SPL
1030 * @brief recursive directory iterator
1031 * @version 1.1
1032 * @since PHP 5.0
1033 */
1034class RecursiveDirectoryIterator extends DirectoryIterator implements RecursiveIterator
1035{
1036	const CURRENT_AS_FILEINFO   0x00000000; /* make RecursiveDirectoryTree::current() return SplFileInfo */
1037	const CURRENT_AS_SELF       0x00000010; /* make RecursiveDirectoryTree::current() return getSelf() */
1038	const CURRENT_AS_PATHNAME   0x00000020; /* make RecursiveDirectoryTree::current() return getPathname() */
1039
1040	const KEY_AS_PATHNAME       0x00000000; /* make RecursiveDirectoryTree::key() return getPathname() */
1041	const KEY_AS_FILENAME       0x00000100; /* make RecursiveDirectoryTree::key() return getFilename() */
1042
1043	const NEW_CURRENT_AND_KEY   0x00000100; /* CURRENT_AS_FILEINFO + KEY_AS_FILENAME */
1044
1045	/** Construct a directory iterator from a path-string.
1046	 *
1047	 * @param $path   directory to iterate.
1048	 * @param $flags  open flags
1049	 * - CURRENT_AS_FILEINFO
1050	 * - CURRENT_AS_SELF
1051	 * - CURRENT_AS_PATHNAME
1052	 * - KEY_AS_PATHNAME
1053	 * - KEY_AS_FILENAME
1054	 * - NEW_CURRENT_AND_KEY
1055	 */
1056	function __construct($path, $flags = 0) {/**/}
1057
1058	/** @return getPathname() or getFilename() depending on flags
1059	 */
1060	function key() {/**/}
1061
1062	/** @return getFilename() or getFileInfo() depending on flags
1063	 */
1064	function current() {/**/}
1065
1066	/** @return whether the current is a directory (not '.' or '..').
1067	 */
1068	function hasChildren() {/**/}
1069
1070	/** @return a RecursiveDirectoryIterator for the current entry.
1071	 */
1072	function getChildren() {/**/}
1073
1074	/** @return sub path only (without main path)
1075	 */
1076	function getSubPath() {/**/}
1077
1078	/** @return the current sub path
1079	 */
1080	function getSubPathname() {/**/}
1081}
1082
1083/** @ingroup SPL
1084 * @brief recursive SimpleXML_Element iterator
1085 * @since PHP 5.0
1086 *
1087 * The SimpleXMLIterator implements the RecursiveIterator interface. This
1088 * allows iteration over all elements using foreach or an appropriate while
1089 * construct, just like SimpleXMLElement does. When using the foreach construct,
1090 * you will also iterate over the subelements. For every element which
1091 * has subelements, hasChildren() returns true.  This will trigger a call to
1092 * getChildren() which returns the iterator for that sub element.
1093 */
1094class SimpleXMLIterator extends SimpleXMLElement implements RecursiveIterator, Countable
1095{
1096	/** @return whether the current node has sub nodes.
1097	 */
1098	function hasChildren() {/**/}
1099
1100	/** @return a SimpleXMLIterator for the current node.
1101	 */
1102	function getChildren() {/**/}
1103
1104	/** @return number of elements/attributes seen with foreach()
1105	 */
1106	function count() {/**/}
1107
1108	/** @copydoc Iterator::rewind */
1109	function rewind() {/**/}
1110
1111	/** @copydoc Iterator::valid */
1112	function valid() {/**/}
1113
1114	/** @copydoc Iterator::current */
1115	function current() {/**/}
1116
1117	/** @copydoc Iterator::key */
1118	function key() {/**/}
1119
1120	/** @copydoc Iterator::next */
1121	function next() {/**/}
1122}
1123
1124/** @ingroup SPL
1125 * @brief Observer of the observer pattern
1126 * @since PHP 5.1
1127 *
1128 * For a detailed explanation see Observer pattern in
1129 * <em>
1130 * Gamma, Helm, Johnson, Vlissides<br />
1131 * Design Patterns
1132 * </em>
1133 */
1134interface SplObserver
1135{
1136	/** Called from the subject (i.e. when it's value has changed).
1137	 * @param $subject the callee
1138	 */
1139	function update(SplSubject $subject);
1140}
1141
1142/** @ingroup SPL
1143 * @brief Subject to the observer pattern
1144 * @since PHP 5.1
1145 * @see Observer
1146 */
1147interface SplSubject
1148{
1149	/** @param $observer new observer to attach
1150	 */
1151	function attach(SplObserver $observer);
1152
1153	/** @param $observer existing observer to detach
1154	 * @note a non attached observer shouldn't result in a warning or similar
1155	 */
1156	function detach(SplObserver $observer);
1157
1158	/** Notify all observers
1159	 */
1160	function notify();
1161}
1162
1163?>
1164