rejigger systemlib
I've always been a bit sad about having all classes in the same file to govern inclusion order. And the filenames didn't match the class names. Instead, lets not rely on whatever order `find` returns, and instead hard-code the ordering of the system lib. I grouped the files by what extension they came from.
Esse commit está contido em:
+3114
-3552
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -0,0 +1,54 @@
|
||||
# Files to include in systemlib.php
|
||||
|
||||
# Order matters here. Put parent classes in this list before child classes
|
||||
hphp/system/classes/lang/Traversable.php
|
||||
hphp/system/classes/lang/Iterator.php
|
||||
hphp/system/classes/lang/IteratorAggregate.php
|
||||
hphp/system/classes/lang/KeyedIterator.php
|
||||
hphp/system/classes/lang/KeyedIterable.php
|
||||
hphp/system/classes/lang/Exception.php
|
||||
hphp/system/classes/spl/exceptions/exceptions.php
|
||||
hphp/system/classes/spl/interfaces/Countable.php
|
||||
hphp/system/classes/spl/interfaces/RecursiveIterator.php
|
||||
|
||||
hphp/system/classes/spl/datastructures/SplHeap.php
|
||||
|
||||
hphp/system/classes/spl/file_handling/SplFileInfo.php
|
||||
hphp/system/classes/spl/interfaces/SeekableIterator.php
|
||||
hphp/system/classes/spl/iterators/DirectoryIterator.php
|
||||
hphp/system/classes/spl/iterators/FilesystemIterator.php
|
||||
hphp/system/classes/spl/iterators/RecursiveDirectoryIterator.php
|
||||
hphp/system/classes/spl/file_handling/SplFileObject.php
|
||||
|
||||
hphp/system/classes/spl/interfaces/OuterIterator.php
|
||||
hphp/system/classes/spl/iterators/IteratorIterator.php
|
||||
|
||||
# If you have no inheritance relationship, go here in alphabetical order
|
||||
hphp/system/classes/DebuggerCommand.php
|
||||
hphp/system/classes/XhprofFrame.php
|
||||
hphp/system/classes/array_filter.hhas
|
||||
hphp/system/classes/array_map.hhas
|
||||
hphp/system/classes/asio/Awaitable.php
|
||||
hphp/system/classes/asio/InvalidOperationException.php
|
||||
hphp/system/classes/collections/collections.php
|
||||
hphp/system/classes/dom/DOMException.php
|
||||
hphp/system/classes/file_system/Directory.php
|
||||
hphp/system/classes/json/JsonSerializable.php
|
||||
hphp/system/classes/lang/ArrayAccess.php
|
||||
hphp/system/classes/lang/ErrorException.php
|
||||
hphp/system/classes/lang/Serializeable.php
|
||||
hphp/system/classes/lang/stdClass.php
|
||||
hphp/system/classes/pdo/PDOException.php
|
||||
hphp/system/classes/reflection/reflection.php
|
||||
hphp/system/classes/soap/SoapFault.php
|
||||
hphp/system/classes/spl/datastructures/SplObjectStorage.php
|
||||
hphp/system/classes/spl/datastructures/SplPriorityQueue.php
|
||||
hphp/system/classes/spl/iterators/AppendIterator.php
|
||||
hphp/system/classes/spl/iterators/ArrayIterator.php
|
||||
hphp/system/classes/spl/iterators/FilterIterator.php
|
||||
hphp/system/classes/spl/iterators/RecursiveIteratorIterator.php
|
||||
hphp/system/classes/spl/miscellaneous/ArrayObject.php
|
||||
|
||||
hphp/system/classes_hhvm/pinitSentinel.php
|
||||
hphp/system/classes_hhvm/resource.php
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
class InvalidOperationException extends RuntimeException {}
|
||||
@@ -1,454 +0,0 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.directoryiterator.php )
|
||||
*
|
||||
* The DirectoryIterator class provides a simple interface for viewing the
|
||||
* contents of filesystem directories.
|
||||
*
|
||||
*/
|
||||
class DirectoryIterator extends SplFileInfo
|
||||
implements Traversable, SeekableIterator {
|
||||
|
||||
private $dir;
|
||||
private $dirName;
|
||||
private $index;
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.construct.php
|
||||
* )
|
||||
*
|
||||
* Constructs a new directory iterator from a path.
|
||||
*
|
||||
* @path mixed The path of the directory to traverse.
|
||||
*/
|
||||
public function __construct($path) {
|
||||
// next() will fill in the correct filename
|
||||
parent::__construct(null);
|
||||
|
||||
if (!is_dir($path)) {
|
||||
throw new UnexpectedValueException(
|
||||
"DirectoryIterator::__construct($path): failed to open dir"
|
||||
);
|
||||
}
|
||||
|
||||
$this->dirName = rtrim($path, DIRECTORY_SEPARATOR);
|
||||
$this->dir = opendir($path);
|
||||
$this->rewind();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.current.php )
|
||||
*
|
||||
* Get the current DirectoryIterator item.
|
||||
*
|
||||
* @return mixed The current DirectoryIterator item.
|
||||
*/
|
||||
public function current() {
|
||||
return clone $this;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.key.php )
|
||||
*
|
||||
* Get the key for the current DirectoryIterator item.
|
||||
*
|
||||
* @return mixed The key for the current DirectoryIterator item.
|
||||
*/
|
||||
public function key() {
|
||||
return $this->index;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.next.php )
|
||||
*
|
||||
* Move forward to the next DirectoryIterator item.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function next() {
|
||||
$file_name = readdir($this->dir);
|
||||
if ($file_name === false) {
|
||||
$this->setPathname(false);
|
||||
} else {
|
||||
$this->setPathname($this->dirName.DIRECTORY_SEPARATOR.$file_name);
|
||||
}
|
||||
$this->index++;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.rewind.php )
|
||||
*
|
||||
* Rewind the DirectoryIterator back to the start.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function rewind() {
|
||||
rewinddir($this->dir);
|
||||
$this->index = -1;
|
||||
$this->next();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.seek.php )
|
||||
*
|
||||
* Seek to a given position in the DirectoryIterator.
|
||||
*
|
||||
* @position mixed The zero-based numeric position to seek to.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function seek($position) {
|
||||
for ($i = $this->index; $i < $position; $i++) {
|
||||
$this->next();
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.tostring.php )
|
||||
*
|
||||
* Get the file name of the current DirectoryIterator item.
|
||||
*
|
||||
* @return mixed Returns the file name of the current
|
||||
* DirectoryIterator item.
|
||||
*/
|
||||
public function __toString() {
|
||||
return $this->getFilename();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.valid.php )
|
||||
*
|
||||
* Check whether current DirectoryIterator position is a valid file.
|
||||
*
|
||||
* @return mixed Returns TRUE if the position is valid, otherwise
|
||||
* FALSE
|
||||
*/
|
||||
public function valid() {
|
||||
return $this->getPathname() !== false;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.isdot.php )
|
||||
*
|
||||
* Determines if the current DirectoryIterator item is a directory and
|
||||
* either . or ...
|
||||
*
|
||||
* @return mixed TRUE if the entry is . or .., otherwise FALSE
|
||||
*/
|
||||
public function isDot() {
|
||||
return $this->getFilename() == '.' || $this->getFilename() == '..';
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.filesystemiterator.php )
|
||||
*
|
||||
* The Filesystem iterator
|
||||
*
|
||||
*/
|
||||
class FilesystemIterator extends DirectoryIterator
|
||||
implements SeekableIterator, Traversable, Iterator {
|
||||
|
||||
const CURRENT_AS_PATHNAME = 32;
|
||||
const CURRENT_AS_FILEINFO = 0;
|
||||
const CURRENT_AS_SELF = 16;
|
||||
const CURRENT_MODE_MASK = 240;
|
||||
const KEY_AS_PATHNAME = 0;
|
||||
const KEY_AS_FILENAME = 256;
|
||||
const FOLLOW_SYMLINKS = 512;
|
||||
const KEY_MODE_MASK = 3840;
|
||||
const NEW_CURRENT_AND_KEY = 256;
|
||||
const SKIP_DOTS = 4096;
|
||||
const UNIX_PATHS = 8192;
|
||||
|
||||
private $flags;
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filesystemiterator.construct.php
|
||||
* )
|
||||
*
|
||||
* Constructs a new filesystem iterator from the path.
|
||||
*
|
||||
* @path mixed The path of the filesystem item to be iterated over.
|
||||
* @flags mixed Flags may be provided which will affect the behavior
|
||||
* of some methods. A list of the flags can found under
|
||||
* FilesystemIterator predefined constants. They can
|
||||
* also be set later with
|
||||
* FilesystemIterator::setFlags()
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function __construct(string $path, int $flags = null) {
|
||||
parent::__construct($path);
|
||||
if ($flags === null) {
|
||||
$flags = FilesystemIterator::KEY_AS_PATHNAME |
|
||||
FilesystemIterator::CURRENT_AS_FILEINFO |
|
||||
FilesystemIterator::SKIP_DOTS;
|
||||
}
|
||||
$this->flags = $flags;
|
||||
$this->goPastDotsIfNeeded();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filesystemiterator.current.php )
|
||||
*
|
||||
* Get file information of the current element.
|
||||
*
|
||||
* @return mixed The filename, file information, or $this depending
|
||||
* on the set flags. See the FilesystemIterator
|
||||
* constants.
|
||||
*/
|
||||
public function current() {
|
||||
$f = parent::current();
|
||||
if ($this->flags & FilesystemIterator::CURRENT_AS_PATHNAME) {
|
||||
return $f->getPathname();
|
||||
} else if ($this->flags & FilesystemIterator::CURRENT_AS_SELF) {
|
||||
return $this;
|
||||
}
|
||||
// FilesystemIterator::CURRENT_AS_FILEINFO == 0
|
||||
return $f;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filesystemiterator.getflags.php
|
||||
* )
|
||||
*
|
||||
* Gets the handling flags, as set in FilesystemIterator::__construct() or
|
||||
* FilesystemIterator::setFlags().
|
||||
*
|
||||
* @return mixed The integer value of the set flags.
|
||||
*/
|
||||
public function getFlags() {
|
||||
return $this->flags;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filesystemiterator.key.php )
|
||||
*
|
||||
*
|
||||
* @return mixed Returns the pathname or filename depending on the
|
||||
* set flags. See the FilesystemIterator constants.
|
||||
*/
|
||||
public function key() {
|
||||
if ($this->flags & FilesystemIterator::KEY_AS_FILENAME) {
|
||||
return parent::current()->getFileName();
|
||||
}
|
||||
// FilesystemIterator::KEY_AS_PATHNAME == 0
|
||||
return parent::current()->getPathName();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filesystemiterator.next.php )
|
||||
*
|
||||
* Move to the next file.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function next() {
|
||||
parent::next();
|
||||
$this->goPastDotsIfNeeded();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filesystemiterator.rewind.php )
|
||||
*
|
||||
* Rewinds the directory back to the start.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function rewind() {
|
||||
parent::rewind();
|
||||
$this->goPastDotsIfNeeded();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filesystemiterator.setflags.php
|
||||
* )
|
||||
*
|
||||
* Sets handling flags.
|
||||
*
|
||||
* @flags mixed The handling flags to set. See the
|
||||
* FilesystemIterator constants.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function setFlags(int $flags) {
|
||||
$this->flags = $flags;
|
||||
}
|
||||
|
||||
private function goPastDotsIfNeeded() {
|
||||
if ($this->flags & FilesystemIterator::SKIP_DOTS) {
|
||||
$f = parent::current();
|
||||
while ($f && $f->isDot()) {
|
||||
parent::next();
|
||||
$f = parent::current();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
return $this->getPathname();
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/class.recursivedirectoryiterator.php )
|
||||
*
|
||||
* The RecursiveDirectoryIterator provides an interface for iterating
|
||||
* recursively over filesystem directories.
|
||||
*
|
||||
*/
|
||||
class RecursiveDirectoryIterator extends FilesystemIterator
|
||||
implements RecursiveIterator {
|
||||
|
||||
const FOLLOW_SYMLINKS = 512;
|
||||
|
||||
private $subPath;
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursivedirectoryiterator.construct.php )
|
||||
*
|
||||
* Constructs a RecursiveDirectoryIterator() for the provided path.
|
||||
*
|
||||
* @path mixed The path of the directory to be iterated over.
|
||||
* @flags mixed Flags may be provided which will affect the behavior
|
||||
* of some methods. A list of the flags can found under
|
||||
* FilesystemIterator predefined constants. They can
|
||||
* also be set later with
|
||||
* FilesystemIterator::setFlags().
|
||||
*
|
||||
* @return mixed Returns the newly created
|
||||
* RecursiveDirectoryIterator.
|
||||
*/
|
||||
public function __construct($path, $flags = null) {
|
||||
if ($flags === null) {
|
||||
$flags = FilesystemIterator::KEY_AS_PATHNAME |
|
||||
FilesystemIterator::CURRENT_AS_FILEINFO;
|
||||
}
|
||||
parent::__construct($path, $flags);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursivedirectoryiterator.haschildren.php )
|
||||
*
|
||||
*
|
||||
* @return mixed Returns whether the current entry is a directory,
|
||||
* but not '.' or '..'
|
||||
*/
|
||||
public function hasChildren() {
|
||||
if ($this->isDot()) {
|
||||
return false;
|
||||
}
|
||||
if (is_link($this->getFilename()) &&
|
||||
!($this->flags & self::FOLLOW_SYMLINKS)) {
|
||||
return false;
|
||||
}
|
||||
return $this->isDir();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursivedirectoryiterator.getchildren.php )
|
||||
*
|
||||
*
|
||||
* @return mixed The filename, file information, or $this depending
|
||||
* on the set flags. See the FilesystemIterator
|
||||
* constants.
|
||||
*/
|
||||
public function getChildren() {
|
||||
if ($this->getFlags() & FilesystemIterator::CURRENT_AS_PATHNAME) {
|
||||
return $this->current();
|
||||
}
|
||||
$child = new self($this->getPathname(), $this->getFlags());
|
||||
$child->subPath = $this->subPath;
|
||||
if ($child->subPath) {
|
||||
$child->subPath .= DIRECTORY_SEPARATOR;
|
||||
}
|
||||
$child->subPath .= $this->getPathname();
|
||||
return $child;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursivedirectoryiterator.getsubpath.php )
|
||||
*
|
||||
* Gets the sub path. WarningThis function is currently not documented;
|
||||
* only its argument list is available.
|
||||
*
|
||||
* @return mixed The sub path (sub directory).
|
||||
*/
|
||||
public function getSubPath() {
|
||||
return $this->subPath;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursivedirectoryiterator.getsubpathname.php )
|
||||
*
|
||||
* Gets the sub path and filename. WarningThis function is currently not
|
||||
* documented; only its argument list is available.
|
||||
*
|
||||
* @return mixed The sub path (sub directory) and filename.
|
||||
*/
|
||||
public function getSubPathname() {
|
||||
return ($this->subPath ? $this->subPath . DIRECTORY_SEPARATOR : '') .
|
||||
$this->getPathname();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursivedirectoryiterator.rewind.php )
|
||||
*
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function rewind() {
|
||||
parent::rewind();
|
||||
if ($this->isDot()) {
|
||||
$this->next();
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursivedirectoryiterator.next.php )
|
||||
*
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function next() {
|
||||
do {
|
||||
parent::next();
|
||||
} while ($this->valid() && $this->isDot());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.domexception.php )
|
||||
*
|
||||
* DOM operations raise exceptions under particular circumstances, i.e.,
|
||||
* when an operation is impossible to perform for logical reasons.
|
||||
*
|
||||
* See also Exceptions.
|
||||
*
|
||||
*/
|
||||
class DOMException extends Exception {
|
||||
public function __construct($message, $code) {
|
||||
parent::__construct($message, $code);
|
||||
}
|
||||
}
|
||||
@@ -1,603 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4: */
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 2002-2004 Brent Cook |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This library is free software; you can redistribute it and/or |
|
||||
// | modify it under the terms of the GNU Lesser General Public |
|
||||
// | License as published by the Free Software Foundation; either |
|
||||
// | version 2.1 of the License, or (at your option) any later version. |
|
||||
// | |
|
||||
// | This library is distributed in the hope that it will be useful, |
|
||||
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | Lesser General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU Lesser General Public |
|
||||
// | License along with this library; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA|
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Brent Cook <busterbcook@yahoo.com> |
|
||||
// | Jason Pell <jasonpell@hotmail.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id: Lexer.php,v 1.20 2004/05/07 12:33:35 busterb Exp $
|
||||
//
|
||||
|
||||
// {{{ token definitions
|
||||
// variables: 'ident', 'sys_var'
|
||||
// values: 'real_val', 'text_val', 'int_val', null
|
||||
// }}}
|
||||
|
||||
/**
|
||||
* A lexigraphical analyser inspired by the msql lexer
|
||||
*
|
||||
* @author Brent Cook <busterbcook@yahoo.com>
|
||||
* @version 0.5
|
||||
* @access public
|
||||
* @package SQL_Parser
|
||||
*/
|
||||
class FB_MySQLLexer
|
||||
{
|
||||
// array of valid tokens for the lexer to recognize
|
||||
// format is 'token literal'=>TOKEN_VALUE
|
||||
var $symbols = array();
|
||||
|
||||
// {{{ instance variables
|
||||
var $tokPtr = 0;
|
||||
var $tokStart = 0;
|
||||
var $tokLen = 0;
|
||||
var $tokText = '';
|
||||
var $lineNo = 0;
|
||||
var $lineBegin = 0;
|
||||
var $string = '';
|
||||
var $stringLen = 0;
|
||||
|
||||
// Will not be altered by skip()
|
||||
var $tokAbsStart = 0;
|
||||
var $skipText = '';
|
||||
|
||||
// Provide lookahead capability.
|
||||
var $lookahead = 0;
|
||||
// Specify how many tokens to save in tokenStack, so the
|
||||
// token stream can be pushed back.
|
||||
var $tokenStack = array();
|
||||
var $stackPtr = 0;
|
||||
// }}}
|
||||
|
||||
// {{{ incidental functions
|
||||
function __construct($string = '', $lookahead=0)
|
||||
{
|
||||
$this->string = $string;
|
||||
$this->stringLen = strlen($string);
|
||||
$this->lookahead = $lookahead;
|
||||
}
|
||||
|
||||
function get() {
|
||||
++$this->tokPtr;
|
||||
++$this->tokLen;
|
||||
return ($this->tokPtr <= $this->stringLen) ? $this->string{$this->tokPtr - 1} : null;
|
||||
}
|
||||
|
||||
function unget() {
|
||||
--$this->tokPtr;
|
||||
--$this->tokLen;
|
||||
}
|
||||
|
||||
function skip() {
|
||||
++$this->tokStart;
|
||||
return ($this->tokPtr != $this->stringLen) ? $this->string{$this->tokPtr++} : '';
|
||||
}
|
||||
|
||||
function revert() {
|
||||
$this->tokPtr = $this->tokStart;
|
||||
$this->tokLen = 0;
|
||||
}
|
||||
|
||||
function isCompop($c) {
|
||||
return (($c == '<') || ($c == '>') || ($c == '=') || ($c == '!'));
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ pushBack()
|
||||
/*
|
||||
* Push back a token, so the very next call to lex() will return that token.
|
||||
* Calls to this function will be ignored if there is no lookahead specified
|
||||
* to the constructor, or the pushBack() function has already been called the
|
||||
* maximum number of token's that can be looked ahead.
|
||||
*/
|
||||
function pushBack()
|
||||
{
|
||||
if($this->lookahead>0 && count($this->tokenStack)>0 && $this->stackPtr>0) {
|
||||
$this->stackPtr--;
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ lex()
|
||||
function lex()
|
||||
{
|
||||
if($this->lookahead>0) {
|
||||
// The stackPtr, should always be the same as the count of
|
||||
// elements in the tokenStack. The stackPtr, can be thought
|
||||
// of as pointing to the next token to be added. If however
|
||||
// a pushBack() call is made, the stackPtr, will be less than the
|
||||
// count, to indicate that we should take that token from the
|
||||
// stack, instead of calling nextToken for a new token.
|
||||
|
||||
if ($this->stackPtr<count($this->tokenStack)) {
|
||||
|
||||
$this->tokText = $this->tokenStack[$this->stackPtr]['tokText'];
|
||||
$this->skipText = $this->tokenStack[$this->stackPtr]['skipText'];
|
||||
$token = $this->tokenStack[$this->stackPtr]['token'];
|
||||
|
||||
// We have read the token, so now iterate again.
|
||||
$this->stackPtr++;
|
||||
return $token;
|
||||
|
||||
} else {
|
||||
|
||||
// If $tokenStack is full (equal to lookahead), pop the oldest
|
||||
// element off, to make room for the new one.
|
||||
|
||||
if ($this->stackPtr == $this->lookahead) {
|
||||
// For some reason array_shift and
|
||||
// array_pop screw up the indexing, so we do it manually.
|
||||
for($i=0; $i<(count($this->tokenStack)-1); $i++) {
|
||||
$this->tokenStack[$i] = $this->tokenStack[$i+1];
|
||||
}
|
||||
|
||||
// Indicate that we should put the element in
|
||||
// at the stackPtr position.
|
||||
$this->stackPtr--;
|
||||
}
|
||||
|
||||
$token = $this->nextToken();
|
||||
$this->tokenStack[$this->stackPtr] =
|
||||
array('token'=>$token,
|
||||
'tokText'=>$this->tokText,
|
||||
'skipText'=>$this->skipText);
|
||||
$this->stackPtr++;
|
||||
return $token;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->nextToken();
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ nextToken()
|
||||
function nextToken()
|
||||
{
|
||||
if ($this->string == '') return;
|
||||
$state = 0;
|
||||
$this->tokAbsStart = $this->tokStart;
|
||||
|
||||
while (true){
|
||||
//echo "State: $state, Char: $c\n";
|
||||
switch($state) {
|
||||
// {{{ State 0 : Start of token
|
||||
case 0:
|
||||
$this->tokPtr = $this->tokStart;
|
||||
$this->tokText = '';
|
||||
$this->tokLen = 0;
|
||||
$c = $this->get();
|
||||
|
||||
if (is_null($c)) { // End Of Input
|
||||
$state = 1000;
|
||||
break;
|
||||
}
|
||||
|
||||
while (($c == ' ') || ($c == "\t")
|
||||
|| ($c == "\n") || ($c == "\r")) {
|
||||
if ($c == "\n" || $c == "\r") {
|
||||
// Handle MAC/Unix/Windows line endings.
|
||||
if($c == "\r") {
|
||||
$c = $this->skip();
|
||||
|
||||
// If not DOS newline
|
||||
if($c != "\n")
|
||||
$this->unget();
|
||||
}
|
||||
++$this->lineNo;
|
||||
$this->lineBegin = $this->tokPtr;
|
||||
}
|
||||
|
||||
$c = $this->skip();
|
||||
$this->tokLen = 1;
|
||||
}
|
||||
|
||||
// Escape quotes and backslashes
|
||||
if ($c == '\\') {
|
||||
$t = $this->get();
|
||||
if ($t == '\'' || $t == '\\' || $t == '"') {
|
||||
$this->tokText = $t;
|
||||
$this->tokStart = $this->tokPtr;
|
||||
return $this->tokText;
|
||||
} else {
|
||||
$this->unget();
|
||||
|
||||
// Unknown token. Revert to single char
|
||||
$state = 999;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (($c == '\'') || ($c == '"')) { // text string
|
||||
$quote = $c;
|
||||
$state = 12;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($c == '_') { // system variable
|
||||
$state = 18;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($c == '`') { // escaped ident
|
||||
$state = 20;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ctype_alpha($c)) { // keyword or ident
|
||||
$state = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ctype_digit($c)) { // real or int number
|
||||
$state = 5;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($c == '.') {
|
||||
$t = $this->get();
|
||||
if ($t == '.') { // ellipsis
|
||||
if ($this->get() == '.') {
|
||||
$this->tokText = '...';
|
||||
$this->tokStart = $this->tokPtr;
|
||||
return $this->tokText;
|
||||
} else {
|
||||
$state = 999;
|
||||
break;
|
||||
}
|
||||
} else if (ctype_digit($t)) { // real number
|
||||
$this->unget();
|
||||
$state = 7;
|
||||
break;
|
||||
} else { // period
|
||||
$this->unget();
|
||||
}
|
||||
}
|
||||
|
||||
if ($c == '#') { // Comments
|
||||
$state = 14;
|
||||
break;
|
||||
}
|
||||
if ($c == '-') {
|
||||
$t = $this->get();
|
||||
if ($t == '-') {
|
||||
$state = 14;
|
||||
break;
|
||||
} else {
|
||||
// negative number ... or - used as an operator
|
||||
$state = 999;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->isCompop($c)) { // comparison operator
|
||||
$state = 10;
|
||||
break;
|
||||
}
|
||||
// Unknown token. Revert to single char
|
||||
$state = 999;
|
||||
break;
|
||||
// }}}
|
||||
|
||||
// {{{ State 1 : Incomplete keyword or ident
|
||||
case 1:
|
||||
$c = $this->get();
|
||||
if (ctype_alnum($c) || ($c == '_')) {
|
||||
$state = 1;
|
||||
break;
|
||||
}
|
||||
$state = 2;
|
||||
break;
|
||||
// }}}
|
||||
|
||||
// {{{ State 20 : Incomplete keyword or ident
|
||||
case 20:
|
||||
do {
|
||||
$c = $this->get();
|
||||
} while ('`' != $c);
|
||||
|
||||
$c = $this->get();
|
||||
$state = 2;
|
||||
break;
|
||||
// }}}
|
||||
|
||||
/* {{{ State 2 : Complete keyword or ident */
|
||||
case 2:
|
||||
$this->unget();
|
||||
$this->tokText = substr($this->string, $this->tokStart,
|
||||
$this->tokLen);
|
||||
|
||||
$testToken = strtolower($this->tokText);
|
||||
if (isset($this->symbols[$testToken])) {
|
||||
|
||||
$this->skipText = substr($this->string, $this->tokAbsStart,
|
||||
$this->tokStart-$this->tokAbsStart);
|
||||
$this->tokStart = $this->tokPtr;
|
||||
return $testToken;
|
||||
} else {
|
||||
$this->skipText = substr($this->string, $this->tokAbsStart,
|
||||
$this->tokStart-$this->tokAbsStart);
|
||||
$this->tokStart = $this->tokPtr;
|
||||
$this->tokText = trim($this->tokText, '`');
|
||||
return 'ident';
|
||||
}
|
||||
break;
|
||||
// }}}
|
||||
|
||||
// {{{ State 5: Incomplete real or int number
|
||||
case 5:
|
||||
$c = $this->get();
|
||||
if (ctype_digit($c)) {
|
||||
$state = 5;
|
||||
break;
|
||||
} else if ($c == '.') {
|
||||
$t = $this->get();
|
||||
if ($t == '.') { // ellipsis
|
||||
$this->unget();
|
||||
} else { // real number
|
||||
$state = 7;
|
||||
break;
|
||||
}
|
||||
} else if(ctype_alpha($c)) { // number must end with non-alpha character
|
||||
$state = 999;
|
||||
break;
|
||||
} else {
|
||||
// complete number
|
||||
$state = 6;
|
||||
break;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ State 6: Complete integer number
|
||||
case 6:
|
||||
$this->unget();
|
||||
$this->tokText = intval(substr($this->string, $this->tokStart,
|
||||
$this->tokLen));
|
||||
$this->skipText = substr($this->string, $this->tokAbsStart,
|
||||
$this->tokStart-$this->tokAbsStart);
|
||||
$this->tokStart = $this->tokPtr;
|
||||
return 'int_val';
|
||||
break;
|
||||
// }}}
|
||||
|
||||
// {{{ State 7: Incomplete real number
|
||||
case 7:
|
||||
$c = $this->get();
|
||||
|
||||
/* Analogy Start */
|
||||
if ($c == 'e' || $c == 'E') {
|
||||
$state = 15;
|
||||
break;
|
||||
}
|
||||
/* Analogy End */
|
||||
|
||||
if (ctype_digit($c)) {
|
||||
$state = 7;
|
||||
break;
|
||||
}
|
||||
$state = 8;
|
||||
break;
|
||||
// }}}
|
||||
|
||||
// {{{ State 8: Complete real number */
|
||||
case 8:
|
||||
$this->unget();
|
||||
$this->tokText = floatval(substr($this->string, $this->tokStart,
|
||||
$this->tokLen));
|
||||
$this->skipText = substr($this->string, $this->tokAbsStart,
|
||||
$this->tokStart-$this->tokAbsStart);
|
||||
$this->tokStart = $this->tokPtr;
|
||||
return 'real_val';
|
||||
// }}}
|
||||
|
||||
// {{{ State 10: Incomplete comparison operator
|
||||
case 10:
|
||||
$c = $this->get();
|
||||
if ($this->isCompop($c))
|
||||
{
|
||||
$state = 10;
|
||||
break;
|
||||
}
|
||||
$state = 11;
|
||||
break;
|
||||
// }}}
|
||||
|
||||
// {{{ State 11: Complete comparison operator
|
||||
case 11:
|
||||
$this->unget();
|
||||
$this->tokText = substr($this->string, $this->tokStart,
|
||||
$this->tokLen);
|
||||
if($this->tokText) {
|
||||
$this->skipText = substr($this->string, $this->tokAbsStart,
|
||||
$this->tokStart-$this->tokAbsStart);
|
||||
$this->tokStart = $this->tokPtr;
|
||||
return $this->tokText;
|
||||
}
|
||||
$state = 999;
|
||||
break;
|
||||
// }}}
|
||||
|
||||
// {{{ State 12: Incomplete text string
|
||||
case 12:
|
||||
$bail = false;
|
||||
$text = '';
|
||||
while (!$bail) {
|
||||
$c = $this->get();
|
||||
switch ($c) {
|
||||
case '':
|
||||
$this->tokText = null;
|
||||
$bail = true;
|
||||
break;
|
||||
case "\\":
|
||||
$c = $this->get();
|
||||
switch ($c) {
|
||||
// undo mysql_escape_string
|
||||
case '0':
|
||||
$text .= "\0";
|
||||
break;
|
||||
case 'r':
|
||||
$text .= "\r";
|
||||
break;
|
||||
case 'n':
|
||||
$text .= "\n";
|
||||
break;
|
||||
case 'Z':
|
||||
$text .= "\x1a";
|
||||
break;
|
||||
default:
|
||||
if (!$c) {
|
||||
$this->tokText = null;
|
||||
$bail = true;
|
||||
} else {
|
||||
$text .= $c;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case $quote:
|
||||
$this->tokText = $text;
|
||||
$bail = true;
|
||||
break;
|
||||
default:
|
||||
$text .= $c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!is_null($this->tokText)) {
|
||||
$state = 13;
|
||||
break;
|
||||
}
|
||||
$state = 999;
|
||||
break;
|
||||
// }}}
|
||||
|
||||
// {{{ State 13: Complete text string
|
||||
case 13:
|
||||
$this->skipText = substr($this->string, $this->tokAbsStart,
|
||||
$this->tokStart-$this->tokAbsStart);
|
||||
$this->tokStart = $this->tokPtr;
|
||||
return 'text_val';
|
||||
break;
|
||||
// }}}
|
||||
|
||||
// {{{ State 14: Comment
|
||||
case 14:
|
||||
$c = $this->skip();
|
||||
if ($c == "\n" || $c == "\r" || $c == "") {
|
||||
// Handle MAC/Unix/Windows line endings.
|
||||
if ($c == "\r") {
|
||||
$c = $this->skip();
|
||||
// If not DOS newline
|
||||
if ($c != "\n") {
|
||||
$this->unget();
|
||||
}
|
||||
}
|
||||
|
||||
if ($c != "") {
|
||||
++$this->lineNo;
|
||||
$this->lineBegin = $this->tokPtr;
|
||||
}
|
||||
|
||||
// We need to skip all the text.
|
||||
$this->tokStart = $this->tokPtr;
|
||||
$state = 0;
|
||||
} else {
|
||||
$state = 14;
|
||||
}
|
||||
break;
|
||||
// }}}
|
||||
|
||||
// {{{ State 15: Exponent Sign in Scientific Notation
|
||||
case 15:
|
||||
$c = $this->get();
|
||||
if($c == '-' || $c == '+') {
|
||||
$state = 16;
|
||||
break;
|
||||
}
|
||||
$state = 999;
|
||||
break;
|
||||
// }}}
|
||||
|
||||
// {{{ state 16: Exponent Value-first digit in Scientific Notation
|
||||
case 16:
|
||||
$c = $this->get();
|
||||
if (ctype_digit($c)) {
|
||||
$state = 17;
|
||||
break;
|
||||
}
|
||||
$state = 999; // if no digit, then token is unknown
|
||||
break;
|
||||
// }}}
|
||||
|
||||
// {{{ State 17: Exponent Value in Scientific Notation
|
||||
case 17:
|
||||
$c = $this->get();
|
||||
if (ctype_digit($c)) {
|
||||
$state = 17;
|
||||
break;
|
||||
}
|
||||
$state = 8; // At least 1 exponent digit was required
|
||||
break;
|
||||
// }}}
|
||||
|
||||
// {{{ State 18 : Incomplete System Variable
|
||||
case 18:
|
||||
$c = $this->get();
|
||||
if (ctype_alnum($c) || $c == '_') {
|
||||
$state = 18;
|
||||
break;
|
||||
}
|
||||
$state = 19;
|
||||
break;
|
||||
// }}}
|
||||
|
||||
// {{{ State 19: Complete Sys Var
|
||||
case 19:
|
||||
$this->unget();
|
||||
$this->tokText = substr($this->string, $this->tokStart,
|
||||
$this->tokLen);
|
||||
$this->skipText = substr($this->string, $this->tokAbsStart,
|
||||
$this->tokStart-$this->tokAbsStart);
|
||||
$this->tokStart = $this->tokPtr;
|
||||
return 'sys_var';
|
||||
// }}}
|
||||
|
||||
// {{{ State 999 : Unknown token. Revert to single char
|
||||
case 999:
|
||||
$this->revert();
|
||||
$this->tokText = $this->get();
|
||||
$this->skipText = substr($this->string, $this->tokAbsStart,
|
||||
$this->tokStart-$this->tokAbsStart);
|
||||
$this->tokStart = $this->tokPtr;
|
||||
return $this->tokText;
|
||||
// }}}
|
||||
|
||||
// {{{ State 1000 : End Of Input
|
||||
case 1000:
|
||||
$this->tokText = '*end of input*';
|
||||
$this->skipText = substr($this->string, $this->tokAbsStart,
|
||||
$this->tokStart-$this->tokAbsStart);
|
||||
$this->tokStart = $this->tokPtr;
|
||||
return null;
|
||||
// }}}
|
||||
}
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
}
|
||||
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.jsonserializable.php )
|
||||
*
|
||||
* Objects implementing JsonSerializable can customize their JSON
|
||||
* representation when encoded with json_encode().
|
||||
*
|
||||
*/
|
||||
interface JsonSerializable {
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/jsonserializable.jsonserialize.php )
|
||||
*
|
||||
* Serializes the object to a value that can be serialized natively by
|
||||
* json_encode().
|
||||
*
|
||||
* @return mixed Returns data which can be serialized by
|
||||
* json_encode(), which is a value of any type other
|
||||
* than a resource.
|
||||
*/
|
||||
public function jsonSerialize();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.errorexception.php )
|
||||
*
|
||||
* An Error Exception.
|
||||
*
|
||||
*/
|
||||
class ErrorException extends Exception {
|
||||
protected $severity;
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/errorexception.construct.php )
|
||||
*
|
||||
* Constructs the Exception.
|
||||
*
|
||||
* @message mixed The Exception message to throw.
|
||||
* @code mixed The Exception code.
|
||||
* @severity mixed The severity level of the exception.
|
||||
* @filename mixed The filename where the exception is thrown.
|
||||
* @lineno mixed The line number where the exception is thrown.
|
||||
*/
|
||||
public function __construct($message = "", $code = 0, $severity = 0,
|
||||
$filename = null, $lineno = null) {
|
||||
parent::__construct($message, $code);
|
||||
$this->severity = $severity;
|
||||
if ($filename !== null) {
|
||||
$this->file = $filename;
|
||||
}
|
||||
if ($lineno !== null) {
|
||||
$this->line = $lineno;
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/errorexception.getseverity.php )
|
||||
*
|
||||
* Returns the severity of the exception.
|
||||
*
|
||||
* @return mixed Returns the severity level of the exception.
|
||||
*/
|
||||
final public function getSeverity() { return $this->severity; }
|
||||
}
|
||||
|
||||
@@ -210,200 +210,3 @@ class Exception {
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.logicexception.php )
|
||||
*
|
||||
* Exception that represents error in the program logic. This kind of
|
||||
* exceptions should directly lead to a fix in your code.
|
||||
*
|
||||
*/
|
||||
class LogicException extends Exception {}
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/class.badfunctioncallexception.php )
|
||||
*
|
||||
* Exception thrown if a callback refers to an undefined function or if
|
||||
* some arguments are missing.
|
||||
*
|
||||
*/
|
||||
class BadFunctionCallException extends LogicException {}
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.badmethodcallexception.php
|
||||
* )
|
||||
*
|
||||
* Exception thrown if a callback refers to an undefined method or if some
|
||||
* arguments are missing.
|
||||
*
|
||||
*/
|
||||
class BadMethodCallException extends BadFunctionCallException {}
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.domainexception.php )
|
||||
*
|
||||
* Exception thrown if a value does not adhere to a defined valid data
|
||||
* domain.
|
||||
*
|
||||
*/
|
||||
class DomainException extends LogicException {}
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/class.invalidargumentexception.php )
|
||||
*
|
||||
* Exception thrown if an argument does not match with the expected value.
|
||||
*
|
||||
*/
|
||||
class InvalidArgumentException extends LogicException {}
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.lengthexception.php )
|
||||
*
|
||||
* Exception thrown if a length is invalid.
|
||||
*
|
||||
*/
|
||||
class LengthException extends LogicException {}
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.outofrangeexception.php )
|
||||
*
|
||||
* Exception thrown when an illegal index was requested. This represents
|
||||
* errors that should be detected at compile time.
|
||||
*
|
||||
*/
|
||||
class OutOfRangeException extends LogicException {}
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.runtimeexception.php )
|
||||
*
|
||||
* Exception thrown if an error which can only be found on runtime occurs.
|
||||
*
|
||||
*/
|
||||
class RuntimeException extends Exception {}
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.outofboundsexception.php )
|
||||
*
|
||||
* Exception thrown if a value is not a valid key. This represents errors
|
||||
* that cannot be detected at compile time.
|
||||
*
|
||||
*/
|
||||
class OutOfBoundsException extends RuntimeException {}
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.overflowexception.php )
|
||||
*
|
||||
* Exception thrown when adding an element to a full container.
|
||||
*
|
||||
*/
|
||||
class OverflowException extends RuntimeException {}
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.rangeexception.php )
|
||||
*
|
||||
* Exception thrown to indicate range errors during program execution.
|
||||
* Normally this means there was an arithmetic error other than
|
||||
* under/overflow. This is the runtime version of DomainException.
|
||||
*
|
||||
*/
|
||||
class RangeException extends RuntimeException {}
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.underflowexception.php )
|
||||
*
|
||||
* Exception thrown when performing an invalid operation on an empty
|
||||
* container, such as removing an element.
|
||||
*
|
||||
*/
|
||||
class UnderflowException extends RuntimeException {}
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/class.unexpectedvalueexception.php )
|
||||
*
|
||||
* Exception thrown if a value does not match with a set of values.
|
||||
* Typically this happens when a function calls another function and
|
||||
* expects the return value to be of a certain type or value not including
|
||||
* arithmetic or buffer related errors.
|
||||
*
|
||||
*/
|
||||
class UnexpectedValueException extends RuntimeException {}
|
||||
|
||||
class InvalidOperationException extends RuntimeException {}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.errorexception.php )
|
||||
*
|
||||
* An Error Exception.
|
||||
*
|
||||
*/
|
||||
class ErrorException extends Exception {
|
||||
protected $severity;
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/errorexception.construct.php )
|
||||
*
|
||||
* Constructs the Exception.
|
||||
*
|
||||
* @message mixed The Exception message to throw.
|
||||
* @code mixed The Exception code.
|
||||
* @severity mixed The severity level of the exception.
|
||||
* @filename mixed The filename where the exception is thrown.
|
||||
* @lineno mixed The line number where the exception is thrown.
|
||||
*/
|
||||
public function __construct($message = "", $code = 0, $severity = 0,
|
||||
$filename = null, $lineno = null) {
|
||||
parent::__construct($message, $code);
|
||||
$this->severity = $severity;
|
||||
if ($filename !== null) {
|
||||
$this->file = $filename;
|
||||
}
|
||||
if ($lineno !== null) {
|
||||
$this->line = $lineno;
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/errorexception.getseverity.php )
|
||||
*
|
||||
* Returns the severity of the exception.
|
||||
*
|
||||
* @return mixed Returns the severity level of the exception.
|
||||
*/
|
||||
final public function getSeverity() { return $this->severity; }
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.domexception.php )
|
||||
*
|
||||
* DOM operations raise exceptions under particular circumstances, i.e.,
|
||||
* when an operation is impossible to perform for logical reasons.
|
||||
*
|
||||
* See also Exceptions.
|
||||
*
|
||||
*/
|
||||
class DOMException extends Exception {
|
||||
public function __construct($message, $code) {
|
||||
parent::__construct($message, $code);
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.pdoexception.php )
|
||||
*
|
||||
* Represents an error raised by PDO. You should not throw a PDOException
|
||||
* from your own code. See Exceptions for more information about Exceptions
|
||||
* in PHP.
|
||||
*
|
||||
*/
|
||||
class PDOException extends Exception {
|
||||
public function __construct() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.iterator.php )
|
||||
*
|
||||
* Interface for external iterators or objects that can be iterated
|
||||
* themselves internally.
|
||||
*
|
||||
*/
|
||||
interface Iterator extends Traversable {
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/iterator.current.php )
|
||||
*
|
||||
* Returns the current element.
|
||||
*
|
||||
* @return mixed Can return any type.
|
||||
*/
|
||||
public function current();
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/iterator.key.php )
|
||||
*
|
||||
* Returns the key of the current element.
|
||||
*
|
||||
* @return mixed Returns scalar on success, or NULL on failure.
|
||||
*/
|
||||
public function key();
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/iterator.next.php )
|
||||
*
|
||||
* Moves the current position to the next element.
|
||||
*
|
||||
* This method is called after each foreach loop.
|
||||
*
|
||||
* @return mixed Any returned value is ignored.
|
||||
*/
|
||||
public function next();
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/iterator.rewind.php )
|
||||
*
|
||||
* Rewinds back to the first element of the Iterator.
|
||||
*
|
||||
* This is the first method called when starting a foreach loop. It will
|
||||
* not be executed after foreach loops.
|
||||
*
|
||||
* @return mixed Any returned value is ignored.
|
||||
*/
|
||||
public function rewind();
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/iterator.valid.php )
|
||||
*
|
||||
* This method is called after Iterator::rewind() and Iterator::next() to
|
||||
* check if the current position is valid.
|
||||
*
|
||||
* @return mixed The return value will be casted to boolean and then
|
||||
* evaluated. Returns TRUE on success or FALSE on
|
||||
* failure.
|
||||
*/
|
||||
public function valid();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.iteratoraggregate.php )
|
||||
*
|
||||
* Interface to create an external Iterator.
|
||||
*
|
||||
*/
|
||||
interface IteratorAggregate extends Traversable {
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/iteratoraggregate.getiterator.php )
|
||||
*
|
||||
* Returns an external iterator.
|
||||
*
|
||||
* @return mixed An instance of an object implementing Iterator or
|
||||
* Traversable
|
||||
*/
|
||||
public function getIterator();
|
||||
}
|
||||
|
||||
interface Iterable extends IteratorAggregate {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
interface KeyedIterable extends Iterable, KeyedTraversable {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
interface KeyedIterator extends Iterator, KeyedTraversable {
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.serializable.php )
|
||||
*
|
||||
* Interface for customized serializing.
|
||||
*
|
||||
* Classes that implement this interface no longer support __sleep() and
|
||||
* __wakeup(). The method serialize is called whenever an instance needs to
|
||||
* be serialized. This does not invoke __destruct() or has any other side
|
||||
* effect unless programmed inside the method. When the data is
|
||||
* unserialized the class is known and the appropriate unserialize() method
|
||||
* is called as a constructor instead of calling __construct(). If you need
|
||||
* to execute the standard constructor you may do so in the method.
|
||||
*
|
||||
*/
|
||||
interface Serializable {
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/serializable.serialize.php )
|
||||
*
|
||||
* Should return the string representation of the object.
|
||||
*
|
||||
* This method acts as the destructor of the object. The __destruct()
|
||||
* method will not be called after this method.
|
||||
*
|
||||
* @return mixed Returns the string representation of the object or
|
||||
* NULL
|
||||
*/
|
||||
public function serialize();
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/serializable.unserialize.php )
|
||||
*
|
||||
* Called during unserialization of the object.
|
||||
*
|
||||
* This method acts as the constructor of the object. The __construct()
|
||||
* method will not be called after this method.
|
||||
*
|
||||
* @serialized mixed The string representation of the object.
|
||||
*
|
||||
* @return mixed The return value from this method is ignored.
|
||||
*/
|
||||
public function unserialize($serialized);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.traversable.php )
|
||||
*
|
||||
* Interface to detect if a class is traversable using foreach.
|
||||
*
|
||||
* Abstract base interface that cannot be implemented alone. Instead it
|
||||
* must be implemented by either IteratorAggregate or Iterator.
|
||||
*
|
||||
* Internal (built-in) classes that implement this interface can be used
|
||||
* in a foreach construct and do not need to implement IteratorAggregate or
|
||||
* Iterator.
|
||||
*
|
||||
* This is an internal engine interface which cannot be implemented in PHP
|
||||
* scripts. Either IteratorAggregate or Iterator must be used instead. When
|
||||
* implementing an interface which extends Traversable, make sure to list
|
||||
* IteratorAggregate or Iterator before its name in the implements clause.
|
||||
*
|
||||
*/
|
||||
interface Traversable {
|
||||
}
|
||||
|
||||
interface KeyedTraversable extends Traversable {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.pdoexception.php )
|
||||
*
|
||||
* Represents an error raised by PDO. You should not throw a PDOException
|
||||
* from your own code. See Exceptions for more information about Exceptions
|
||||
* in PHP.
|
||||
*
|
||||
*/
|
||||
class PDOException extends Exception {
|
||||
public function __construct() {
|
||||
}
|
||||
}
|
||||
@@ -291,7 +291,6 @@ abstract class SplHeap implements Iterator, Countable {
|
||||
private static function parentIndex($childIndex) {
|
||||
return floor(($childIndex - 1) / 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.logicexception.php )
|
||||
*
|
||||
* Exception that represents error in the program logic. This kind of
|
||||
* exceptions should directly lead to a fix in your code.
|
||||
*
|
||||
*/
|
||||
class LogicException extends Exception {}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/class.badfunctioncallexception.php )
|
||||
*
|
||||
* Exception thrown if a callback refers to an undefined function or if
|
||||
* some arguments are missing.
|
||||
*
|
||||
*/
|
||||
class BadFunctionCallException extends LogicException {}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.badmethodcallexception.php
|
||||
* )
|
||||
*
|
||||
* Exception thrown if a callback refers to an undefined method or if some
|
||||
* arguments are missing.
|
||||
*
|
||||
*/
|
||||
class BadMethodCallException extends BadFunctionCallException {}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.domainexception.php )
|
||||
*
|
||||
* Exception thrown if a value does not adhere to a defined valid data
|
||||
* domain.
|
||||
*
|
||||
*/
|
||||
class DomainException extends LogicException {}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/class.invalidargumentexception.php )
|
||||
*
|
||||
* Exception thrown if an argument does not match with the expected value.
|
||||
*
|
||||
*/
|
||||
class InvalidArgumentException extends LogicException {}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.lengthexception.php )
|
||||
*
|
||||
* Exception thrown if a length is invalid.
|
||||
*
|
||||
*/
|
||||
class LengthException extends LogicException {}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.outofrangeexception.php )
|
||||
*
|
||||
* Exception thrown when an illegal index was requested. This represents
|
||||
* errors that should be detected at compile time.
|
||||
*
|
||||
*/
|
||||
class OutOfRangeException extends LogicException {}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.runtimeexception.php )
|
||||
*
|
||||
* Exception thrown if an error which can only be found on runtime occurs.
|
||||
*
|
||||
*/
|
||||
class RuntimeException extends Exception {}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.outofboundsexception.php )
|
||||
*
|
||||
* Exception thrown if a value is not a valid key. This represents errors
|
||||
* that cannot be detected at compile time.
|
||||
*
|
||||
*/
|
||||
class OutOfBoundsException extends RuntimeException {}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.overflowexception.php )
|
||||
*
|
||||
* Exception thrown when adding an element to a full container.
|
||||
*
|
||||
*/
|
||||
class OverflowException extends RuntimeException {}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.rangeexception.php )
|
||||
*
|
||||
* exception thrown to indicate range errors during program execution.
|
||||
* Normally this means there was an arithmetic error other than
|
||||
* under/overflow. This is the runtime version of DomainException.
|
||||
*
|
||||
*/
|
||||
class RangeException extends RuntimeException {}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.underflowexception.php )
|
||||
*
|
||||
* exception thrown when performing an invalid operation on an empty
|
||||
* container, such as removing an element.
|
||||
*
|
||||
*/
|
||||
class UnderflowException extends RuntimeException {}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/class.unexpectedvalueexception.php )
|
||||
*
|
||||
* exception thrown if a value does not match with a set of values.
|
||||
* Typically this happens when a function calls another function and
|
||||
* expects the return value to be of a certain type or value not including
|
||||
* arithmetic or buffer related errors.
|
||||
*
|
||||
*/
|
||||
class UnexpectedValueException extends RuntimeException {}
|
||||
@@ -0,0 +1,432 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.splfileinfo.php )
|
||||
*
|
||||
* The SplFileInfo class offers a high-level object oriented interface to
|
||||
* information for an individual file.
|
||||
*
|
||||
*/
|
||||
class SplFileInfo {
|
||||
|
||||
private $fileName;
|
||||
private $fileClass;
|
||||
private $infoClass;
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.construct.php )
|
||||
*
|
||||
* Creates a new SplFileInfo object for the file_name specified. The file
|
||||
* does not need to exist, or be readable.
|
||||
*
|
||||
* @file_name mixed Path to the file.
|
||||
*/
|
||||
public function __construct($file_name) {
|
||||
$this->setPathname($file_name);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getpath.php )
|
||||
*
|
||||
* Returns the path to the file, omitting the filename and any trailing
|
||||
* slash.
|
||||
*
|
||||
* @return mixed Returns the path to the file.
|
||||
*/
|
||||
public function getPath() {
|
||||
return dirname($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getfilename.php )
|
||||
*
|
||||
* Gets the filename without any path information.
|
||||
*
|
||||
* @return mixed The filename.
|
||||
*/
|
||||
public function getFilename() {
|
||||
return $this->getBasename();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getfileinfo.php )
|
||||
*
|
||||
* This method gets an SplFileInfo object for the referenced file.
|
||||
*
|
||||
* @class_name mixed Name of an SplFileInfo derived class to use.
|
||||
*
|
||||
* @return mixed An SplFileInfo object created for the file.
|
||||
*/
|
||||
public function getFileInfo($class_name = null) {
|
||||
if (!$class_name) {
|
||||
$class_name = $this->fileClass;
|
||||
}
|
||||
return new $class_name($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getbasename.php )
|
||||
*
|
||||
* This method returns the base name of the file, directory, or link
|
||||
* without path info.
|
||||
*
|
||||
* @suffix mixed Optional suffix to omit from the base name returned.
|
||||
*
|
||||
* @return mixed Returns the base name without path information.
|
||||
*/
|
||||
public function getBasename($suffix = "") {
|
||||
return basename($this->getPathname(), $suffix);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getpathname.php )
|
||||
*
|
||||
* Returns the path to the file.
|
||||
*
|
||||
* @return mixed The path to the file.
|
||||
*/
|
||||
public function getPathname() {
|
||||
return $this->fileName;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getpathinfo.php )
|
||||
*
|
||||
* Gets an SplFileInfo object for the parent of the current file.
|
||||
*
|
||||
* @class_name mixed Name of an SplFileInfo derived class to use.
|
||||
*
|
||||
* @return mixed Returns an SplFileInfo object for the parent path of
|
||||
* the file.
|
||||
*/
|
||||
public function getPathInfo($class_name = null) {
|
||||
if (!$class_name) {
|
||||
$class_name = $this->fileClass;
|
||||
}
|
||||
return new $class_name($this->getPath());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getperms.php )
|
||||
*
|
||||
* Gets the file permissions for the file.
|
||||
*
|
||||
* @return mixed Returns the file permissions.
|
||||
*/
|
||||
public function getPerms() {
|
||||
return fileperms($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getinode.php )
|
||||
*
|
||||
* Gets the inode number for the filesystem object.
|
||||
*
|
||||
* @return mixed Returns the inode number for the filesystem object.
|
||||
*/
|
||||
public function getInode() {
|
||||
return fileinode($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getsize.php )
|
||||
*
|
||||
* Returns the filesize in bytes for the file referenced.
|
||||
*
|
||||
* @return mixed The filesize in bytes.
|
||||
*/
|
||||
public function getSize() {
|
||||
return filesize($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getowner.php )
|
||||
*
|
||||
* Gets the file owner. The owner ID is returned in numerical format.
|
||||
*
|
||||
* @return mixed The owner id in numerical format.
|
||||
*/
|
||||
public function getOwner() {
|
||||
return fileowner($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getgroup.php )
|
||||
*
|
||||
* Gets the file group. The group ID is returned in numerical format.
|
||||
*
|
||||
* @return mixed The group id in numerical format.
|
||||
*/
|
||||
public function getGroup() {
|
||||
return filegroup($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getatime.php )
|
||||
*
|
||||
* Gets the last access time for the file.
|
||||
*
|
||||
* @return mixed Returns the time the file was last accessed.
|
||||
*/
|
||||
public function getATime() {
|
||||
return fileatime($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getmtime.php )
|
||||
*
|
||||
* Returns the time when the contents of the file were changed. The time
|
||||
* returned is a Unix timestamp.
|
||||
*
|
||||
* @return mixed Returns the last modified time for the file, in a
|
||||
* Unix timestamp.
|
||||
*/
|
||||
public function getMTime() {
|
||||
return filemtime($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getctime.php )
|
||||
*
|
||||
* Returns the inode change time for the file. The time returned is a Unix
|
||||
* timestamp.
|
||||
*
|
||||
* @return mixed The last change time, in a Unix timestamp.
|
||||
*/
|
||||
public function getCTime() {
|
||||
return filectime($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.gettype.php )
|
||||
*
|
||||
* Returns the type of the file referenced.
|
||||
*
|
||||
* @return mixed A string representing the type of the entry. May be
|
||||
* one of file, link, or dir
|
||||
*/
|
||||
public function getType() {
|
||||
return filetype($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getextension.php )
|
||||
*
|
||||
* Retrieves the file extension.
|
||||
*
|
||||
* @return mixed Returns a string containing the file extension, or
|
||||
* an empty string if the file has no extension.
|
||||
*/
|
||||
public function getExtension() {
|
||||
return pathinfo($this->getPathname(), PATHINFO_EXTENSION);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.iswritable.php )
|
||||
*
|
||||
* Checks if the current entry is writable.
|
||||
*
|
||||
* @return mixed Returns TRUE if writable, FALSE otherwise;
|
||||
*/
|
||||
public function isWritable() {
|
||||
return is_writable($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.isreadable.php )
|
||||
*
|
||||
* Check if the file is readable.
|
||||
*
|
||||
* @return mixed Returns TRUE if readable, FALSE otherwise.
|
||||
*/
|
||||
public function isReadable() {
|
||||
return is_readable($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.isexecutable.php )
|
||||
*
|
||||
* Checks if the file is executable.
|
||||
*
|
||||
* @return mixed Returns TRUE if executable, FALSE otherwise.
|
||||
*/
|
||||
public function isExecutable() {
|
||||
return is_executable($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.isfile.php )
|
||||
*
|
||||
* Checks if the file referenced by this SplFileInfo object exists and is
|
||||
* a regular file.
|
||||
*
|
||||
* @return mixed Returns TRUE if the file exists and is a regular
|
||||
* file (not a link), FALSE otherwise.
|
||||
*/
|
||||
public function isFile() {
|
||||
return is_file($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.isdir.php )
|
||||
*
|
||||
* This method can be used to determine if the file is a directory.
|
||||
*
|
||||
* @return mixed Returns TRUE if a directory, FALSE otherwise.
|
||||
*/
|
||||
public function isDir() {
|
||||
return is_dir($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.islink.php )
|
||||
*
|
||||
* Use this method to check if the file referenced by the SplFileInfo
|
||||
* object is a link.
|
||||
*
|
||||
* @return mixed Returns TRUE if the file is a link, FALSE otherwise.
|
||||
*/
|
||||
public function isLink() {
|
||||
return is_link($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getlinktarget.php )
|
||||
*
|
||||
* Gets the target of a filesystem link.
|
||||
*
|
||||
* The target may not be the real path on the filesystem. Use
|
||||
* SplFileInfo::getRealPath() to determine the true path on the filesystem.
|
||||
*
|
||||
* @return mixed Returns the target of the filesystem link.
|
||||
*/
|
||||
public function getLinkTarget() {
|
||||
$link = @readlink($this->getPathname());
|
||||
if ($link === false) {
|
||||
throw new Exception(
|
||||
'Unable to read link '.$this->getPathname()
|
||||
);
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getrealpath.php )
|
||||
*
|
||||
* This method expands all symbolic links, resolves relative references
|
||||
* and returns the real path to the file.
|
||||
*
|
||||
* @return mixed Returns the path to the file.
|
||||
*/
|
||||
public function getRealPath() {
|
||||
return realpath($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.tostring.php )
|
||||
*
|
||||
* This method will return the file name of the referenced file.
|
||||
*
|
||||
* @return mixed Returns the path to the file.
|
||||
*/
|
||||
public function __toString() {
|
||||
return $this->getPathname();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.openfile.php )
|
||||
*
|
||||
* Creates an SplFileObject object of the file. This is useful because
|
||||
* SplFileObject contains additional methods for manipulating the file
|
||||
* whereas SplFileInfo is only useful for gaining information, like whether
|
||||
* the file is writable.
|
||||
*
|
||||
* @mode mixed The mode for opening the file. See the fopen()
|
||||
* documentation for descriptions of possible modes.
|
||||
* The default is read only.
|
||||
* @use_include_path
|
||||
* mixed When set to TRUE, the filename is also searched for
|
||||
* within the include_path
|
||||
* @context mixed Refer to the context section of the manual for a
|
||||
* description of contexts.
|
||||
*
|
||||
* @return mixed The opened file as an SplFileObject object.
|
||||
*/
|
||||
public function openFile($mode = 'r', $use_include_path = false,
|
||||
$context = null) {
|
||||
$class_name = $this->fileClass;
|
||||
return new $class_name(
|
||||
$this->getPathname(),
|
||||
$mode,
|
||||
$use_include_path,
|
||||
$context
|
||||
);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.setfileclass.php )
|
||||
*
|
||||
* Set the class name which SplFileInfo will use to open files with when
|
||||
* openFile() is called. The class name passed to this method must be
|
||||
* derived from SplFileObject.
|
||||
*
|
||||
* @class_name mixed The class name to use when openFile() is called.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function setFileClass($class_name = "SplFileObject") {
|
||||
$this->fileClass = $class_name;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.setinfoclass.php )
|
||||
*
|
||||
* Use this method to set a custom class which will be used when
|
||||
* getFileInfo and getPathInfo are called. The class name passed to this
|
||||
* method must be derived from SplFileInfo.
|
||||
*
|
||||
* @class_name mixed The class name to use.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function setInfoClass($class_name = "SplFileInfo") {
|
||||
$this->infoClass = $class_name;
|
||||
}
|
||||
|
||||
protected function setPathname($file_name) {
|
||||
if ($file_name !== false) {
|
||||
$file_name = rtrim($file_name, '/');
|
||||
}
|
||||
$this->fileName = $file_name;
|
||||
}
|
||||
}
|
||||
-431
@@ -1,436 +1,5 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.splfileinfo.php )
|
||||
*
|
||||
* The SplFileInfo class offers a high-level object oriented interface to
|
||||
* information for an individual file.
|
||||
*
|
||||
*/
|
||||
class SplFileInfo {
|
||||
|
||||
private $fileName;
|
||||
private $fileClass;
|
||||
private $infoClass;
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.construct.php )
|
||||
*
|
||||
* Creates a new SplFileInfo object for the file_name specified. The file
|
||||
* does not need to exist, or be readable.
|
||||
*
|
||||
* @file_name mixed Path to the file.
|
||||
*/
|
||||
public function __construct($file_name) {
|
||||
$this->setPathname($file_name);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getpath.php )
|
||||
*
|
||||
* Returns the path to the file, omitting the filename and any trailing
|
||||
* slash.
|
||||
*
|
||||
* @return mixed Returns the path to the file.
|
||||
*/
|
||||
public function getPath() {
|
||||
return dirname($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getfilename.php )
|
||||
*
|
||||
* Gets the filename without any path information.
|
||||
*
|
||||
* @return mixed The filename.
|
||||
*/
|
||||
public function getFilename() {
|
||||
return $this->getBasename();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getfileinfo.php )
|
||||
*
|
||||
* This method gets an SplFileInfo object for the referenced file.
|
||||
*
|
||||
* @class_name mixed Name of an SplFileInfo derived class to use.
|
||||
*
|
||||
* @return mixed An SplFileInfo object created for the file.
|
||||
*/
|
||||
public function getFileInfo($class_name = null) {
|
||||
if (!$class_name) {
|
||||
$class_name = $this->fileClass;
|
||||
}
|
||||
return new $class_name($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getbasename.php )
|
||||
*
|
||||
* This method returns the base name of the file, directory, or link
|
||||
* without path info.
|
||||
*
|
||||
* @suffix mixed Optional suffix to omit from the base name returned.
|
||||
*
|
||||
* @return mixed Returns the base name without path information.
|
||||
*/
|
||||
public function getBasename($suffix = "") {
|
||||
return basename($this->getPathname(), $suffix);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getpathname.php )
|
||||
*
|
||||
* Returns the path to the file.
|
||||
*
|
||||
* @return mixed The path to the file.
|
||||
*/
|
||||
public function getPathname() {
|
||||
return $this->fileName;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getpathinfo.php )
|
||||
*
|
||||
* Gets an SplFileInfo object for the parent of the current file.
|
||||
*
|
||||
* @class_name mixed Name of an SplFileInfo derived class to use.
|
||||
*
|
||||
* @return mixed Returns an SplFileInfo object for the parent path of
|
||||
* the file.
|
||||
*/
|
||||
public function getPathInfo($class_name = null) {
|
||||
if (!$class_name) {
|
||||
$class_name = $this->fileClass;
|
||||
}
|
||||
return new $class_name($this->getPath());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getperms.php )
|
||||
*
|
||||
* Gets the file permissions for the file.
|
||||
*
|
||||
* @return mixed Returns the file permissions.
|
||||
*/
|
||||
public function getPerms() {
|
||||
return fileperms($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getinode.php )
|
||||
*
|
||||
* Gets the inode number for the filesystem object.
|
||||
*
|
||||
* @return mixed Returns the inode number for the filesystem object.
|
||||
*/
|
||||
public function getInode() {
|
||||
return fileinode($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getsize.php )
|
||||
*
|
||||
* Returns the filesize in bytes for the file referenced.
|
||||
*
|
||||
* @return mixed The filesize in bytes.
|
||||
*/
|
||||
public function getSize() {
|
||||
return filesize($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getowner.php )
|
||||
*
|
||||
* Gets the file owner. The owner ID is returned in numerical format.
|
||||
*
|
||||
* @return mixed The owner id in numerical format.
|
||||
*/
|
||||
public function getOwner() {
|
||||
return fileowner($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getgroup.php )
|
||||
*
|
||||
* Gets the file group. The group ID is returned in numerical format.
|
||||
*
|
||||
* @return mixed The group id in numerical format.
|
||||
*/
|
||||
public function getGroup() {
|
||||
return filegroup($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getatime.php )
|
||||
*
|
||||
* Gets the last access time for the file.
|
||||
*
|
||||
* @return mixed Returns the time the file was last accessed.
|
||||
*/
|
||||
public function getATime() {
|
||||
return fileatime($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getmtime.php )
|
||||
*
|
||||
* Returns the time when the contents of the file were changed. The time
|
||||
* returned is a Unix timestamp.
|
||||
*
|
||||
* @return mixed Returns the last modified time for the file, in a
|
||||
* Unix timestamp.
|
||||
*/
|
||||
public function getMTime() {
|
||||
return filemtime($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getctime.php )
|
||||
*
|
||||
* Returns the inode change time for the file. The time returned is a Unix
|
||||
* timestamp.
|
||||
*
|
||||
* @return mixed The last change time, in a Unix timestamp.
|
||||
*/
|
||||
public function getCTime() {
|
||||
return filectime($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.gettype.php )
|
||||
*
|
||||
* Returns the type of the file referenced.
|
||||
*
|
||||
* @return mixed A string representing the type of the entry. May be
|
||||
* one of file, link, or dir
|
||||
*/
|
||||
public function getType() {
|
||||
return filetype($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getextension.php )
|
||||
*
|
||||
* Retrieves the file extension.
|
||||
*
|
||||
* @return mixed Returns a string containing the file extension, or
|
||||
* an empty string if the file has no extension.
|
||||
*/
|
||||
public function getExtension() {
|
||||
return pathinfo($this->getPathname(), PATHINFO_EXTENSION);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.iswritable.php )
|
||||
*
|
||||
* Checks if the current entry is writable.
|
||||
*
|
||||
* @return mixed Returns TRUE if writable, FALSE otherwise;
|
||||
*/
|
||||
public function isWritable() {
|
||||
return is_writable($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.isreadable.php )
|
||||
*
|
||||
* Check if the file is readable.
|
||||
*
|
||||
* @return mixed Returns TRUE if readable, FALSE otherwise.
|
||||
*/
|
||||
public function isReadable() {
|
||||
return is_readable($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.isexecutable.php )
|
||||
*
|
||||
* Checks if the file is executable.
|
||||
*
|
||||
* @return mixed Returns TRUE if executable, FALSE otherwise.
|
||||
*/
|
||||
public function isExecutable() {
|
||||
return is_executable($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.isfile.php )
|
||||
*
|
||||
* Checks if the file referenced by this SplFileInfo object exists and is
|
||||
* a regular file.
|
||||
*
|
||||
* @return mixed Returns TRUE if the file exists and is a regular
|
||||
* file (not a link), FALSE otherwise.
|
||||
*/
|
||||
public function isFile() {
|
||||
return is_file($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.isdir.php )
|
||||
*
|
||||
* This method can be used to determine if the file is a directory.
|
||||
*
|
||||
* @return mixed Returns TRUE if a directory, FALSE otherwise.
|
||||
*/
|
||||
public function isDir() {
|
||||
return is_dir($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.islink.php )
|
||||
*
|
||||
* Use this method to check if the file referenced by the SplFileInfo
|
||||
* object is a link.
|
||||
*
|
||||
* @return mixed Returns TRUE if the file is a link, FALSE otherwise.
|
||||
*/
|
||||
public function isLink() {
|
||||
return is_link($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getlinktarget.php )
|
||||
*
|
||||
* Gets the target of a filesystem link.
|
||||
*
|
||||
* The target may not be the real path on the filesystem. Use
|
||||
* SplFileInfo::getRealPath() to determine the true path on the filesystem.
|
||||
*
|
||||
* @return mixed Returns the target of the filesystem link.
|
||||
*/
|
||||
public function getLinkTarget() {
|
||||
$link = @readlink($this->getPathname());
|
||||
if ($link === false) {
|
||||
throw new Exception(
|
||||
'Unable to read link '.$this->getPathname()
|
||||
);
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.getrealpath.php )
|
||||
*
|
||||
* This method expands all symbolic links, resolves relative references
|
||||
* and returns the real path to the file.
|
||||
*
|
||||
* @return mixed Returns the path to the file.
|
||||
*/
|
||||
public function getRealPath() {
|
||||
return realpath($this->getPathname());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.tostring.php )
|
||||
*
|
||||
* This method will return the file name of the referenced file.
|
||||
*
|
||||
* @return mixed Returns the path to the file.
|
||||
*/
|
||||
public function __toString() {
|
||||
return $this->getPathname();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.openfile.php )
|
||||
*
|
||||
* Creates an SplFileObject object of the file. This is useful because
|
||||
* SplFileObject contains additional methods for manipulating the file
|
||||
* whereas SplFileInfo is only useful for gaining information, like whether
|
||||
* the file is writable.
|
||||
*
|
||||
* @mode mixed The mode for opening the file. See the fopen()
|
||||
* documentation for descriptions of possible modes.
|
||||
* The default is read only.
|
||||
* @use_include_path
|
||||
* mixed When set to TRUE, the filename is also searched for
|
||||
* within the include_path
|
||||
* @context mixed Refer to the context section of the manual for a
|
||||
* description of contexts.
|
||||
*
|
||||
* @return mixed The opened file as an SplFileObject object.
|
||||
*/
|
||||
public function openFile($mode = 'r', $use_include_path = false,
|
||||
$context = null) {
|
||||
$class_name = $this->fileClass;
|
||||
return new $class_name(
|
||||
$this->getPathname(),
|
||||
$mode,
|
||||
$use_include_path,
|
||||
$context
|
||||
);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.setfileclass.php )
|
||||
*
|
||||
* Set the class name which SplFileInfo will use to open files with when
|
||||
* openFile() is called. The class name passed to this method must be
|
||||
* derived from SplFileObject.
|
||||
*
|
||||
* @class_name mixed The class name to use when openFile() is called.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function setFileClass($class_name = "SplFileObject") {
|
||||
$this->fileClass = $class_name;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/splfileinfo.setinfoclass.php )
|
||||
*
|
||||
* Use this method to set a custom class which will be used when
|
||||
* getFileInfo and getPathInfo are called. The class name passed to this
|
||||
* method must be derived from SplFileInfo.
|
||||
*
|
||||
* @class_name mixed The class name to use.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function setInfoClass($class_name = "SplFileInfo") {
|
||||
$this->infoClass = $class_name;
|
||||
}
|
||||
|
||||
protected function setPathname($file_name) {
|
||||
if ($file_name !== false) {
|
||||
$file_name = rtrim($file_name, '/');
|
||||
}
|
||||
$this->fileName = $file_name;
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.splfileobject.php )
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.countable.php )
|
||||
*
|
||||
* Classes implementing Countable can be used with the count() function.
|
||||
*
|
||||
*/
|
||||
interface Countable {
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/countable.count.php )
|
||||
*
|
||||
* This method is executed when using the count() function on an object
|
||||
* implementing Countable.
|
||||
*
|
||||
* @return mixed The custom count as an integer.
|
||||
*
|
||||
* The return value is cast to an integer.
|
||||
*/
|
||||
public function count();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.outeriterator.php )
|
||||
*
|
||||
* Classes implementing OuterIterator can be used to iterate over
|
||||
* iterators.
|
||||
*
|
||||
*/
|
||||
interface OuterIterator extends Iterator {
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/outeriterator.getinneriterator.php )
|
||||
*
|
||||
* Returns the inner iterator for the current iterator entry.
|
||||
*
|
||||
* @return mixed The inner iterator for the current entry.
|
||||
*/
|
||||
public function getInnerIterator();
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.recursiveiterator.php )
|
||||
*
|
||||
* Classes implementing RecursiveIterator can be used to iterate over
|
||||
* iterators recursively.
|
||||
*
|
||||
*/
|
||||
interface RecursiveIterator extends Iterator {
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursiveiterator.getchildren.php )
|
||||
*
|
||||
* Returns an iterator for the current iterator entry.
|
||||
*
|
||||
* @return mixed An iterator for the current entry.
|
||||
*/
|
||||
public function getChildren();
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursiveiterator.haschildren.php )
|
||||
*
|
||||
* Returns if an iterator can be created for the current entry.
|
||||
* RecursiveIterator::getChildren().
|
||||
*
|
||||
* @return mixed Returns TRUE if the current entry can be iterated
|
||||
* over, otherwise returns FALSE.
|
||||
*/
|
||||
public function hasChildren();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.seekableiterator.php )
|
||||
*
|
||||
* The Seekable iterator.
|
||||
*
|
||||
*/
|
||||
interface SeekableIterator extends Iterator {
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/seekableiterator.seek.php )
|
||||
*
|
||||
* Seeks to a given position in the iterator.
|
||||
*
|
||||
* @position mixed The position to seek to.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function seek($position);
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.appenditerator.php )
|
||||
*
|
||||
* An Iterator that iterates over several iterators one after the other.
|
||||
*
|
||||
*/
|
||||
class AppendIterator implements OuterIterator {
|
||||
private $iterators;
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/appenditerator.construct.php )
|
||||
*
|
||||
* Constructs an AppendIterator.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
function __construct() {
|
||||
$this->iterators = new ArrayIterator(array());
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/appenditerator.append.php )
|
||||
*
|
||||
* Appends an iterator.
|
||||
*
|
||||
* @it mixed The iterator to append.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
function append(Iterator $it) {
|
||||
$this->iterators->append($it);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/appenditerator.getinneriterator.php )
|
||||
*
|
||||
* This method returns the current inner iterator.
|
||||
*
|
||||
* @return mixed The current inner iterator, or NULL if there is not
|
||||
* one.
|
||||
*/
|
||||
function getInnerIterator() {
|
||||
return $this->iterators->current();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/appenditerator.rewind.php )
|
||||
*
|
||||
* Rewind to the first element of the first inner Iterator.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
function rewind() {
|
||||
$this->iterators->rewind();
|
||||
if ($this->iterators->valid()) {
|
||||
$this->getInnerIterator()->rewind();
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/appenditerator.valid.php )
|
||||
*
|
||||
* Checks validity of the current element.
|
||||
*
|
||||
* @return mixed Returns TRUE if the current iteration is valid,
|
||||
* FALSE otherwise.
|
||||
*/
|
||||
function valid() {
|
||||
return $this->iterators->valid() && $this->getInnerIterator()->valid();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/appenditerator.current.php )
|
||||
*
|
||||
* Gets the current value.
|
||||
*
|
||||
* @return mixed The current value if it is valid or NULL otherwise.
|
||||
*/
|
||||
function current() {
|
||||
/* Using $this->valid() would be exactly the same; it would omit
|
||||
* the access to a non valid element in the inner iterator. Since
|
||||
* the user didn't respect the valid() return value false this
|
||||
* must be intended hence we go on. */
|
||||
return $this->iterators->valid() ?
|
||||
$this->getInnerIterator()->current() : NULL;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/appenditerator.key.php )
|
||||
*
|
||||
* Get the current key.
|
||||
*
|
||||
* @return mixed The current key if it is valid or NULL otherwise.
|
||||
*/
|
||||
function key() {
|
||||
return $this->iterators->valid() ? $this->getInnerIterator()->key() : NULL;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/appenditerator.next.php )
|
||||
*
|
||||
* Moves to the next element. If this means to another Iterator then it
|
||||
* rewinds that Iterator.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
function next() {
|
||||
if (!$this->iterators->valid()){
|
||||
return; /* done all */
|
||||
}
|
||||
$this->getInnerIterator()->next();
|
||||
if ($this->getInnerIterator()->valid()) {
|
||||
return; /* found valid element in current inner iterator */
|
||||
}
|
||||
$this->iterators->next();
|
||||
while ($this->iterators->valid()) {
|
||||
$this->getInnerIterator()->rewind();
|
||||
if ($this->getInnerIterator()->valid()) {
|
||||
return; /* found element as first elemet in another iterator */
|
||||
}
|
||||
$this->iterators->next();
|
||||
}
|
||||
}
|
||||
|
||||
function __call($func, $params) {
|
||||
return call_user_func_array(array($this->getInnerIterator(), $func),
|
||||
$params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,342 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.arrayiterator.php )
|
||||
*
|
||||
* This iterator allows to unset and modify values and keys while
|
||||
* iterating over Arrays and Objects.
|
||||
*
|
||||
* When you want to iterate over the same array multiple times you need to
|
||||
* instantiate ArrayObject and let it create ArrayIterator instances that
|
||||
* refer to it either by using foreach or by calling its getIterator()
|
||||
* method manually.
|
||||
*
|
||||
*/
|
||||
class ArrayIterator implements ArrayAccess, SeekableIterator, Countable {
|
||||
protected $arr;
|
||||
protected $flags;
|
||||
|
||||
const STD_PROP_LIST = 1;
|
||||
const ARRAY_AS_PROPS = 2;
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.construct.php )
|
||||
*
|
||||
* Constructs an ArrayIterator object. WarningThis function is currently
|
||||
* not documented; only its argument list is available.
|
||||
*
|
||||
* @array mixed The array or object to be iterated on.
|
||||
*
|
||||
* @return mixed An ArrayIterator object.
|
||||
*/
|
||||
public function __construct($array = array(), $flags = 0) {
|
||||
$this->arr = (array) $array;
|
||||
$this->flags = $flags;
|
||||
reset($this->arr);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.append.php )
|
||||
*
|
||||
* Appends value as the last element. WarningThis function is currently
|
||||
* not documented; only its argument list is available.
|
||||
*
|
||||
* @value mixed The value to append.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function append($value) {
|
||||
$this->arr[] = $value;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.asort.php )
|
||||
*
|
||||
* Sorts an array by values. WarningThis function is currently not
|
||||
* documented; only its argument list is available.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function asort() {
|
||||
return asort($this->arr);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.count.php )
|
||||
*
|
||||
* Gets the number of elements in the array, or the number of public
|
||||
* properties in the object. WarningThis function is currently not
|
||||
* documented; only its argument list is available.
|
||||
*
|
||||
* @return mixed The number of elements or public properties in the
|
||||
* associated array or object, respectively.
|
||||
*/
|
||||
public function count() {
|
||||
return count($this->arr);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.current.php )
|
||||
*
|
||||
* Get the current array entry.
|
||||
*
|
||||
* @return mixed The current array entry.
|
||||
*/
|
||||
public function current() {
|
||||
return current($this->arr);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.getarraycopy.php )
|
||||
*
|
||||
* Get a copy of an array. WarningThis function is currently not
|
||||
* documented; only its argument list is available.
|
||||
*
|
||||
* @return mixed A copy of the array, or array of public properties
|
||||
* if ArrayIterator refers to an object.
|
||||
*/
|
||||
public function getArrayCopy() {
|
||||
return $this->arr;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.getflags.php )
|
||||
*
|
||||
* Get the current flags. WarningThis function is currently not
|
||||
* documented; only its argument list is available.
|
||||
*
|
||||
* @return mixed The current flags.
|
||||
*/
|
||||
public function getFlags() {
|
||||
return $this->flags;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.key.php )
|
||||
*
|
||||
* This function returns the current array key
|
||||
*
|
||||
* @return mixed The current array key.
|
||||
*/
|
||||
public function key() {
|
||||
return key($this->arr);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.ksort.php )
|
||||
*
|
||||
* Sorts an array by the keys. WarningThis function is currently not
|
||||
* documented; only its argument list is available.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function ksort() {
|
||||
return ksort($this->arr);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.natcasesort.php )
|
||||
*
|
||||
* Sort the entries by values using a case insensitive "natural order"
|
||||
* algorithm. WarningThis function is currently not documented; only its
|
||||
* argument list is available.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function natcasesort() {
|
||||
return natcasesort($this->arr);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.natsort.php )
|
||||
*
|
||||
* Sort the entries by values using "natural order" algorithm. WarningThis
|
||||
* function is currently not documented; only its argument list is
|
||||
* available.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function natsort() {
|
||||
return natsort($this->arr);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.next.php )
|
||||
*
|
||||
* The iterator to the next entry.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function next() {
|
||||
next($this->arr);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.offsetexists.php )
|
||||
*
|
||||
* Checks if the offset exists. WarningThis function is currently not
|
||||
* documented; only its argument list is available.
|
||||
*
|
||||
* @index mixed The offset being checked.
|
||||
*
|
||||
* @return mixed TRUE if the offset exists, otherwise FALSE
|
||||
*/
|
||||
public function offsetExists($index) {
|
||||
return isset($this->arr[$index]);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.offsetget.php )
|
||||
*
|
||||
* Gets the value from the provided offset. WarningThis function is
|
||||
* currently not documented; only its argument list is available.
|
||||
*
|
||||
* @index mixed The offset to get the value from.
|
||||
*
|
||||
* @return mixed The value at offset index.
|
||||
*/
|
||||
public function offsetGet($index) {
|
||||
return $this->arr[$index];
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.offsetset.php )
|
||||
*
|
||||
* Sets a value for a given offset. WarningThis function is currently not
|
||||
* documented; only its argument list is available.
|
||||
*
|
||||
* @index mixed The index to set for.
|
||||
* @newval mixed The new value to store at the index.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function offsetSet($index, $newval) {
|
||||
$this->arr[$index] = $newval;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.offsetunset.php )
|
||||
*
|
||||
* Unsets a value for an offset. WarningThis function is currently not
|
||||
* documented; only its argument list is available.
|
||||
*
|
||||
* @index mixed The offset to unset.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function offsetUnset($index) {
|
||||
unset($this->arr[$index]);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.rewind.php )
|
||||
*
|
||||
* This rewinds the iterator to the beginning.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function rewind() {
|
||||
reset($this->arr);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.seek.php )
|
||||
*
|
||||
*
|
||||
* @position mixed The position to seek to.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function seek($position) {
|
||||
reset($this->arr);
|
||||
for ($i = 0; $i < $position; $i++) {
|
||||
if (!next($this->arr)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.setflags.php )
|
||||
*
|
||||
* Sets behaviour flags. WarningThis function is currently not documented;
|
||||
* only its argument list is available.
|
||||
*
|
||||
* @flags mixed A bitmask as follows: 0 = Properties of the object
|
||||
* have their normal functionality when accessed as
|
||||
* list (var_dump, foreach, etc.). 1 = Array indices
|
||||
* can be accessed as properties in read/write.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function setFlags($flags) {
|
||||
$this->flags = $flags;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.uasort.php )
|
||||
*
|
||||
* Sort the entries by values using user defined function. WarningThis
|
||||
* function is currently not documented; only its argument list is
|
||||
* available.
|
||||
*
|
||||
* @cmp_function
|
||||
* mixed The compare function used for the sort.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function uasort($cmp_function) {
|
||||
return uasort($this->arr, $cmp_function);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.uksort.php )
|
||||
*
|
||||
* Sort the entries by key using user defined function. WarningThis
|
||||
* function is currently not documented; only its argument list is
|
||||
* available.
|
||||
*
|
||||
* @cmp_function
|
||||
* mixed The compare function used for the sort.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function uksort($cmp_function) {
|
||||
return uksort($this->arr, $cmp_function);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/arrayiterator.valid.php )
|
||||
*
|
||||
* Checks if the array contains any more entries.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function valid() {
|
||||
return key($this->arr) !== null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.directoryiterator.php )
|
||||
*
|
||||
* The DirectoryIterator class provides a simple interface for viewing the
|
||||
* contents of filesystem directories.
|
||||
*
|
||||
*/
|
||||
class DirectoryIterator extends SplFileInfo
|
||||
implements Traversable, SeekableIterator {
|
||||
|
||||
private $dir;
|
||||
private $dirName;
|
||||
private $index;
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.construct.php
|
||||
* )
|
||||
*
|
||||
* Constructs a new directory iterator from a path.
|
||||
*
|
||||
* @path mixed The path of the directory to traverse.
|
||||
*/
|
||||
public function __construct($path) {
|
||||
// next() will fill in the correct filename
|
||||
parent::__construct(null);
|
||||
|
||||
if (!is_dir($path)) {
|
||||
throw new UnexpectedValueException(
|
||||
"DirectoryIterator::__construct($path): failed to open dir"
|
||||
);
|
||||
}
|
||||
|
||||
$this->dirName = rtrim($path, DIRECTORY_SEPARATOR);
|
||||
$this->dir = opendir($path);
|
||||
$this->rewind();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.current.php )
|
||||
*
|
||||
* Get the current DirectoryIterator item.
|
||||
*
|
||||
* @return mixed The current DirectoryIterator item.
|
||||
*/
|
||||
public function current() {
|
||||
return clone $this;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.key.php )
|
||||
*
|
||||
* Get the key for the current DirectoryIterator item.
|
||||
*
|
||||
* @return mixed The key for the current DirectoryIterator item.
|
||||
*/
|
||||
public function key() {
|
||||
return $this->index;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.next.php )
|
||||
*
|
||||
* Move forward to the next DirectoryIterator item.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function next() {
|
||||
$file_name = readdir($this->dir);
|
||||
if ($file_name === false) {
|
||||
$this->setPathname(false);
|
||||
} else {
|
||||
$this->setPathname($this->dirName.DIRECTORY_SEPARATOR.$file_name);
|
||||
}
|
||||
$this->index++;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.rewind.php )
|
||||
*
|
||||
* Rewind the DirectoryIterator back to the start.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function rewind() {
|
||||
rewinddir($this->dir);
|
||||
$this->index = -1;
|
||||
$this->next();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.seek.php )
|
||||
*
|
||||
* Seek to a given position in the DirectoryIterator.
|
||||
*
|
||||
* @position mixed The zero-based numeric position to seek to.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function seek($position) {
|
||||
for ($i = $this->index; $i < $position; $i++) {
|
||||
$this->next();
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.tostring.php )
|
||||
*
|
||||
* Get the file name of the current DirectoryIterator item.
|
||||
*
|
||||
* @return mixed Returns the file name of the current
|
||||
* DirectoryIterator item.
|
||||
*/
|
||||
public function __toString() {
|
||||
return $this->getFilename();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.valid.php )
|
||||
*
|
||||
* Check whether current DirectoryIterator position is a valid file.
|
||||
*
|
||||
* @return mixed Returns TRUE if the position is valid, otherwise
|
||||
* FALSE
|
||||
*/
|
||||
public function valid() {
|
||||
return $this->getPathname() !== false;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/directoryiterator.isdot.php )
|
||||
*
|
||||
* Determines if the current DirectoryIterator item is a directory and
|
||||
* either . or ...
|
||||
*
|
||||
* @return mixed TRUE if the entry is . or .., otherwise FALSE
|
||||
*/
|
||||
public function isDot() {
|
||||
return $this->getFilename() == '.' || $this->getFilename() == '..';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.filesystemiterator.php )
|
||||
*
|
||||
* The Filesystem iterator
|
||||
*
|
||||
*/
|
||||
class FilesystemIterator extends DirectoryIterator
|
||||
implements SeekableIterator, Traversable, Iterator {
|
||||
|
||||
const CURRENT_AS_PATHNAME = 32;
|
||||
const CURRENT_AS_FILEINFO = 0;
|
||||
const CURRENT_AS_SELF = 16;
|
||||
const CURRENT_MODE_MASK = 240;
|
||||
const KEY_AS_PATHNAME = 0;
|
||||
const KEY_AS_FILENAME = 256;
|
||||
const FOLLOW_SYMLINKS = 512;
|
||||
const KEY_MODE_MASK = 3840;
|
||||
const NEW_CURRENT_AND_KEY = 256;
|
||||
const SKIP_DOTS = 4096;
|
||||
const UNIX_PATHS = 8192;
|
||||
|
||||
private $flags;
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filesystemiterator.construct.php
|
||||
* )
|
||||
*
|
||||
* Constructs a new filesystem iterator from the path.
|
||||
*
|
||||
* @path mixed The path of the filesystem item to be iterated over.
|
||||
* @flags mixed Flags may be provided which will affect the behavior
|
||||
* of some methods. A list of the flags can found under
|
||||
* FilesystemIterator predefined constants. They can
|
||||
* also be set later with
|
||||
* FilesystemIterator::setFlags()
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function __construct(string $path, int $flags = null) {
|
||||
parent::__construct($path);
|
||||
if ($flags === null) {
|
||||
$flags = FilesystemIterator::KEY_AS_PATHNAME |
|
||||
FilesystemIterator::CURRENT_AS_FILEINFO |
|
||||
FilesystemIterator::SKIP_DOTS;
|
||||
}
|
||||
$this->flags = $flags;
|
||||
$this->goPastDotsIfNeeded();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filesystemiterator.current.php )
|
||||
*
|
||||
* Get file information of the current element.
|
||||
*
|
||||
* @return mixed The filename, file information, or $this depending
|
||||
* on the set flags. See the FilesystemIterator
|
||||
* constants.
|
||||
*/
|
||||
public function current() {
|
||||
$f = parent::current();
|
||||
if ($this->flags & FilesystemIterator::CURRENT_AS_PATHNAME) {
|
||||
return $f->getPathname();
|
||||
} else if ($this->flags & FilesystemIterator::CURRENT_AS_SELF) {
|
||||
return $this;
|
||||
}
|
||||
// FilesystemIterator::CURRENT_AS_FILEINFO == 0
|
||||
return $f;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filesystemiterator.getflags.php
|
||||
* )
|
||||
*
|
||||
* Gets the handling flags, as set in FilesystemIterator::__construct() or
|
||||
* FilesystemIterator::setFlags().
|
||||
*
|
||||
* @return mixed The integer value of the set flags.
|
||||
*/
|
||||
public function getFlags() {
|
||||
return $this->flags;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filesystemiterator.key.php )
|
||||
*
|
||||
*
|
||||
* @return mixed Returns the pathname or filename depending on the
|
||||
* set flags. See the FilesystemIterator constants.
|
||||
*/
|
||||
public function key() {
|
||||
if ($this->flags & FilesystemIterator::KEY_AS_FILENAME) {
|
||||
return parent::current()->getFileName();
|
||||
}
|
||||
// FilesystemIterator::KEY_AS_PATHNAME == 0
|
||||
return parent::current()->getPathName();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filesystemiterator.next.php )
|
||||
*
|
||||
* Move to the next file.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function next() {
|
||||
parent::next();
|
||||
$this->goPastDotsIfNeeded();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filesystemiterator.rewind.php )
|
||||
*
|
||||
* Rewinds the directory back to the start.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function rewind() {
|
||||
parent::rewind();
|
||||
$this->goPastDotsIfNeeded();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filesystemiterator.setflags.php
|
||||
* )
|
||||
*
|
||||
* Sets handling flags.
|
||||
*
|
||||
* @flags mixed The handling flags to set. See the
|
||||
* FilesystemIterator constants.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function setFlags(int $flags) {
|
||||
$this->flags = $flags;
|
||||
}
|
||||
|
||||
private function goPastDotsIfNeeded() {
|
||||
if ($this->flags & FilesystemIterator::SKIP_DOTS) {
|
||||
$f = parent::current();
|
||||
while ($f && $f->isDot()) {
|
||||
parent::next();
|
||||
$f = parent::current();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
return $this->getPathname();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.filteriterator.php )
|
||||
*
|
||||
* This abstract iterator filters out unwanted values. This class should
|
||||
* be extended to implement custom iterator filters. The
|
||||
* FilterIterator::accept() must be implemented in the subclass.
|
||||
*
|
||||
*/
|
||||
abstract class FilterIterator extends IteratorIterator {
|
||||
private $it;
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filteriterator.construct.php )
|
||||
*
|
||||
* Constructs a new FilterIterator, which consists of a passed in iterator
|
||||
* with filters applied to it. WarningThis function is currently not
|
||||
* documented; only its argument list is available.
|
||||
*
|
||||
* @it mixed The iterator that is being filtered.
|
||||
*
|
||||
* @return mixed The FilterIterator.
|
||||
*/
|
||||
public function __construct(Iterator $it) {
|
||||
$this->it = $it;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filteriterator.rewind.php )
|
||||
*
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function rewind() {
|
||||
$this->it->rewind();
|
||||
$this->fetch();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filteriterator.accept.php )
|
||||
*
|
||||
* Returns whether the current element of the iterator is acceptable
|
||||
* through this filter.
|
||||
*
|
||||
* @return mixed TRUE if the current element is acceptable, otherwise
|
||||
* FALSE.
|
||||
*/
|
||||
abstract function accept();
|
||||
|
||||
private function fetch() {
|
||||
while ($this->it->valid()) {
|
||||
if ($this->accept()) {
|
||||
return;
|
||||
}
|
||||
$this->it->next();
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filteriterator.next.php )
|
||||
*
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function next() {
|
||||
$this->it->next();
|
||||
$this->fetch();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filteriterator.valid.php )
|
||||
*
|
||||
*
|
||||
* @return mixed TRUE if the current element is valid, otherwise
|
||||
* FALSE
|
||||
*/
|
||||
public function valid() {
|
||||
return $this->it->valid();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filteriterator.key.php )
|
||||
*
|
||||
*
|
||||
* @return mixed The current key.
|
||||
*/
|
||||
public function key() {
|
||||
return $this->it->key();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/filteriterator.current.php )
|
||||
*
|
||||
*
|
||||
* @return mixed The current element value.
|
||||
*/
|
||||
public function current() {
|
||||
return $this->it->current();
|
||||
}
|
||||
|
||||
protected function __clone() {
|
||||
// disallow clone
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/filteriterator.getinneriterator.php )
|
||||
*
|
||||
*
|
||||
* @return mixed The inner iterator.
|
||||
*/
|
||||
public function getInnerIterator() {
|
||||
return $this->it;
|
||||
}
|
||||
|
||||
public function __call($func, $params) {
|
||||
return call_user_func_array(array($this->it, $func), $params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/class.iteratoriterator.php )
|
||||
*
|
||||
* This iterator wrapper allows the conversion of anything that is
|
||||
* Traversable into an Iterator. It is important to understand that most
|
||||
* classes that do not implement Iterators have reasons as most likely they
|
||||
* do not allow the full Iterator feature set. If so, techniques should be
|
||||
* provided to prevent misuse, otherwise expect exceptions or fatal errors.
|
||||
*
|
||||
*/
|
||||
class IteratorIterator implements OuterIterator {
|
||||
private $iterator;
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/iteratoriterator.construct.php )
|
||||
*
|
||||
* Creates an iterator from anything that is traversable.
|
||||
*
|
||||
* @iterator mixed The traversable iterator.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function __construct(Traversable $iterator) {
|
||||
if ($iterator instanceof IteratorAggregate) {
|
||||
$iterator = $iterator->getIterator();
|
||||
}
|
||||
if ($iterator instanceof Iterator) {
|
||||
$this->iterator = $iterator;
|
||||
} else {
|
||||
throw new Exception(
|
||||
"Need to pass a Traversable that is convertable to an iterator");
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/iteratoriterator.getinneriterator.php )
|
||||
*
|
||||
* Get the inner iterator.
|
||||
*
|
||||
* @return mixed The inner iterator as passed to
|
||||
* IteratorIterator::__construct().
|
||||
*/
|
||||
public function getInnerIterator() {
|
||||
return $this->iterator;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/iteratoriterator.valid.php )
|
||||
*
|
||||
* Checks if the iterator is valid.
|
||||
*
|
||||
* @return mixed Returns TRUE if the iterator is valid, otherwise
|
||||
* FALSE
|
||||
*/
|
||||
public function valid() {
|
||||
return $this->iterator->valid();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/iteratoriterator.key.php )
|
||||
*
|
||||
* Get the key of the current element.
|
||||
*
|
||||
* @return mixed The key of the current element.
|
||||
*/
|
||||
public function key() {
|
||||
return $this->iterator->key();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/iteratoriterator.current.php )
|
||||
*
|
||||
* Get the value of the current element.
|
||||
*
|
||||
* @return mixed The value of the current element.
|
||||
*/
|
||||
public function current() {
|
||||
return $this->iterator->current();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/iteratoriterator.next.php )
|
||||
*
|
||||
* Forward to the next element.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function next() {
|
||||
return $this->iterator->next();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from http://php.net/manual/en/iteratoriterator.rewind.php )
|
||||
*
|
||||
* Rewinds to the first element.
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function rewind() {
|
||||
return $this->iterator->rewind();
|
||||
}
|
||||
|
||||
public function __call($func, $params) {
|
||||
return call_user_func_array(array($this->iterator, $func), $params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/class.recursivedirectoryiterator.php )
|
||||
*
|
||||
* The RecursiveDirectoryIterator provides an interface for iterating
|
||||
* recursively over filesystem directories.
|
||||
*
|
||||
*/
|
||||
class RecursiveDirectoryIterator extends FilesystemIterator
|
||||
implements RecursiveIterator {
|
||||
|
||||
const FOLLOW_SYMLINKS = 512;
|
||||
|
||||
private $subPath;
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursivedirectoryiterator.construct.php )
|
||||
*
|
||||
* Constructs a RecursiveDirectoryIterator() for the provided path.
|
||||
*
|
||||
* @path mixed The path of the directory to be iterated over.
|
||||
* @flags mixed Flags may be provided which will affect the behavior
|
||||
* of some methods. A list of the flags can found under
|
||||
* FilesystemIterator predefined constants. They can
|
||||
* also be set later with
|
||||
* FilesystemIterator::setFlags().
|
||||
*
|
||||
* @return mixed Returns the newly created
|
||||
* RecursiveDirectoryIterator.
|
||||
*/
|
||||
public function __construct($path, $flags = null) {
|
||||
if ($flags === null) {
|
||||
$flags = FilesystemIterator::KEY_AS_PATHNAME |
|
||||
FilesystemIterator::CURRENT_AS_FILEINFO;
|
||||
}
|
||||
parent::__construct($path, $flags);
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursivedirectoryiterator.haschildren.php )
|
||||
*
|
||||
*
|
||||
* @return mixed Returns whether the current entry is a directory,
|
||||
* but not '.' or '..'
|
||||
*/
|
||||
public function hasChildren() {
|
||||
if ($this->isDot()) {
|
||||
return false;
|
||||
}
|
||||
if (is_link($this->getFilename()) &&
|
||||
!($this->flags & self::FOLLOW_SYMLINKS)) {
|
||||
return false;
|
||||
}
|
||||
return $this->isDir();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursivedirectoryiterator.getchildren.php )
|
||||
*
|
||||
*
|
||||
* @return mixed The filename, file information, or $this depending
|
||||
* on the set flags. See the FilesystemIterator
|
||||
* constants.
|
||||
*/
|
||||
public function getChildren() {
|
||||
if ($this->getFlags() & FilesystemIterator::CURRENT_AS_PATHNAME) {
|
||||
return $this->current();
|
||||
}
|
||||
$child = new self($this->getPathname(), $this->getFlags());
|
||||
$child->subPath = $this->subPath;
|
||||
if ($child->subPath) {
|
||||
$child->subPath .= DIRECTORY_SEPARATOR;
|
||||
}
|
||||
$child->subPath .= $this->getPathname();
|
||||
return $child;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursivedirectoryiterator.getsubpath.php )
|
||||
*
|
||||
* Gets the sub path. WarningThis function is currently not documented;
|
||||
* only its argument list is available.
|
||||
*
|
||||
* @return mixed The sub path (sub directory).
|
||||
*/
|
||||
public function getSubPath() {
|
||||
return $this->subPath;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursivedirectoryiterator.getsubpathname.php )
|
||||
*
|
||||
* Gets the sub path and filename. WarningThis function is currently not
|
||||
* documented; only its argument list is available.
|
||||
*
|
||||
* @return mixed The sub path (sub directory) and filename.
|
||||
*/
|
||||
public function getSubPathname() {
|
||||
return ($this->subPath ? $this->subPath . DIRECTORY_SEPARATOR : '') .
|
||||
$this->getPathname();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursivedirectoryiterator.rewind.php )
|
||||
*
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function rewind() {
|
||||
parent::rewind();
|
||||
if ($this->isDot()) {
|
||||
$this->next();
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursivedirectoryiterator.next.php )
|
||||
*
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function next() {
|
||||
do {
|
||||
parent::next();
|
||||
} while ($this->valid() && $this->isDot());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
<?php
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/class.recursiveiteratoriterator.php )
|
||||
*
|
||||
* Can be used to iterate through recursive iterators.
|
||||
*
|
||||
*/
|
||||
class RecursiveIteratorIterator implements OuterIterator, Traversable {
|
||||
|
||||
const LEAVES_ONLY = 0;
|
||||
const SELF_FIRST = 1;
|
||||
const CHILD_FIRST = 2;
|
||||
const CATCH_GET_CHILD = 16;
|
||||
|
||||
private $iterators = array();
|
||||
private $originalIterator;
|
||||
private $mode;
|
||||
private $flags;
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursiveiteratoriterator.construct.php )
|
||||
*
|
||||
* Creates a RecursiveIteratorIterator from a RecursiveIterator.
|
||||
*
|
||||
* @iterator mixed The iterator being constructed from. Either a
|
||||
* RecursiveIterator or IteratorAggregate.
|
||||
* @mode mixed Optional mode. Possible values are
|
||||
* RecursiveIteratorIterator::LEAVES_ONLY - The
|
||||
* default. Lists only leaves in iteration.
|
||||
* RecursiveIteratorIterator::SELF_FIRST - Lists leaves
|
||||
* and parents in iteration with parents coming first.
|
||||
* RecursiveIteratorIterator::CHILD_FIRST - Lists
|
||||
* leaves and parents in iteration with leaves coming
|
||||
* first.
|
||||
* @flags mixed Optional flag. Possible values are
|
||||
* RecursiveIteratorIterator::CATCH_GET_CHILD which
|
||||
* will then ignore exceptions thrown in calls to
|
||||
* RecursiveIteratorIterator::getChildren().
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function __construct($iterator,
|
||||
$mode = RecursiveIteratorIterator::LEAVES_ONLY,
|
||||
$flags = 0) {
|
||||
$this->iterators[] = array($iterator, 0);
|
||||
$this->originalIterator = $iterator;
|
||||
$this->mode = (int) $mode;
|
||||
$this->flags = $flags;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursiveiteratoriterator.getinneriterator.php
|
||||
* )
|
||||
*
|
||||
* Gets the current active sub iterator. WarningThis function is currently
|
||||
* not documented; only its argument list is available.
|
||||
*
|
||||
* @return mixed The current active sub iterator.
|
||||
*/
|
||||
public function getInnerIterator() {
|
||||
$it = $this->iterators[count($this->iterators)-1][0];
|
||||
if (!$it instanceof RecursiveDirectoryIterator) {
|
||||
throw new NotImplementedException(
|
||||
"RecursiveIteratorIterator only supports RecursiveDirectoryIterator"
|
||||
);
|
||||
}
|
||||
return $it;
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursiveiteratoriterator.current.php )
|
||||
*
|
||||
*
|
||||
* @return mixed The current elements value.
|
||||
*/
|
||||
public function current() {
|
||||
return $this->getInnerIterator()->current();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursiveiteratoriterator.key.php )
|
||||
*
|
||||
*
|
||||
* @return mixed The current key.
|
||||
*/
|
||||
public function key() {
|
||||
return $this->getInnerIterator()->key();
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursiveiteratoriterator.next.php )
|
||||
*
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function next() {
|
||||
if ($this->isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$it = $this->getInnerIterator();
|
||||
|
||||
if ($this->mode == self::SELF_FIRST) {
|
||||
if ($it->hasChildren() && !$this->getInnerIteratorFlag()) {
|
||||
$this->setInnerIteratorFlag(1);
|
||||
$newit = $it->getChildren();
|
||||
$this->iterators[] = array($newit, 0);
|
||||
} else {
|
||||
$it->next();
|
||||
$this->setInnerIteratorFlag(0);
|
||||
}
|
||||
|
||||
if ($this->valid()) {
|
||||
return;
|
||||
}
|
||||
array_pop($this->iterators);
|
||||
return $this->next();
|
||||
} else if ($this->mode == self::CHILD_FIRST ||
|
||||
$this->mode == self::LEAVES_ONLY) {
|
||||
|
||||
if (!$it->valid()) {
|
||||
array_pop($this->iterators);
|
||||
return $this->next();
|
||||
} else if ($it->hasChildren()) {
|
||||
if (!$this->getInnerIteratorFlag()) {
|
||||
$this->setInnerIteratorFlag(1);
|
||||
$this->iterators[] = array($it->getChildren(), 0);
|
||||
if ($this->valid()) {
|
||||
return;
|
||||
}
|
||||
return $this->next();
|
||||
} else {
|
||||
// CHILD_FIRST: 0 - drill down; 1 - visit 2 - next
|
||||
// LEAVES_ONLY: 0 - drill down; 1 - next
|
||||
if ($this->mode == self::CHILD_FIRST &&
|
||||
$this->getInnerIteratorFlag() == 1) {
|
||||
$this->setInnerIteratorFlag(2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->setInnerIteratorFlag(0);
|
||||
$it->next();
|
||||
if ($this->valid()) {
|
||||
return;
|
||||
}
|
||||
return $this->next();
|
||||
} else {
|
||||
$this->setInnerIteratorFlag(0);
|
||||
$it->next();
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursiveiteratoriterator.rewind.php )
|
||||
*
|
||||
*
|
||||
* @return mixed No value is returned.
|
||||
*/
|
||||
public function rewind() {
|
||||
$it = $this->originalIterator;
|
||||
$this->iterators = array(array($it, 0));
|
||||
$it->rewind();
|
||||
|
||||
// Make sure the first entry is valid
|
||||
if (!$this->valid()) {
|
||||
$this->next();
|
||||
}
|
||||
}
|
||||
|
||||
// This doc comment block generated by idl/sysdoc.php
|
||||
/**
|
||||
* ( excerpt from
|
||||
* http://php.net/manual/en/recursiveiteratoriterator.valid.php )
|
||||
*
|
||||
*
|
||||
* @return mixed TRUE if the current position is valid, otherwise
|
||||
* FALSE
|
||||
*/
|
||||
public function valid() {
|
||||
if ($this->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$it = $this->getInnerIterator();
|
||||
if ($it->valid() &&
|
||||
$it->isDir() &&
|
||||
($this->mode == self::LEAVES_ONLY ||
|
||||
($this->mode == self::CHILD_FIRST &&
|
||||
$this->getInnerIteratorFlag() == 0))) {
|
||||
return false;
|
||||
}
|
||||
return $it->valid();
|
||||
}
|
||||
|
||||
private function isEmpty() {
|
||||
return count($this->iterators) == 0;
|
||||
}
|
||||
|
||||
private function getInnerIteratorFlag() {
|
||||
return $this->iterators[count($this->iterators)-1][1];
|
||||
}
|
||||
|
||||
private function setInnerIteratorFlag($flag) {
|
||||
$this->iterators[count($this->iterators)-1][1] = $flag;
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -456,5 +456,4 @@ class ArrayObject implements IteratorAggregate, Traversable, ArrayAccess,
|
||||
return $this->flags & self::ARRAY_AS_PROPS;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -58,17 +58,6 @@ function genSystemlib($input_files) {
|
||||
|
||||
fwrite($systemlib_php, "<?hh\n");
|
||||
fwrite($systemlib_php, '// @' . 'generated' . "\n\n");
|
||||
// There are some dependencies between files, so we output
|
||||
// the classes in a certain order so that all classes can be
|
||||
// hoisted.
|
||||
$initialFiles = array('stdclass.php', 'exception.php', 'arrayaccess.php',
|
||||
'iterator.php', 'splfile.php', 'splheap.php');
|
||||
foreach ($initialFiles as $initialFile) {
|
||||
if (isset($phpfiles[$initialFile])) {
|
||||
processPhpFile($phpfiles[$initialFile], $systemlib_php);
|
||||
unset($phpfiles[$initialFile]);
|
||||
}
|
||||
}
|
||||
foreach ($phpfiles as $key => $phpfile) {
|
||||
if (preg_match('/\.php$/', $phpfile)) {
|
||||
processPhpFile($phpfile, $systemlib_php);
|
||||
|
||||
@@ -40,7 +40,7 @@ if [ "$1" = "systemlib" -o "$1" = "all" ]; then
|
||||
cd $HPHP_HOME
|
||||
[ $VERBOSE -eq 1 ] && echo "Generating bin/systemlib.php"
|
||||
FBCODE_DIR=$HPHP_HOME $HHVM hphp/system/lib/gen_systemlib.php bin/ \
|
||||
`find hphp/system/classes hphp/system/classes_hhvm -name '*.php'`
|
||||
`cat hphp/system/classes.txt | sed -e 's/#.*$//'`
|
||||
check_err $? "Failed generating bin/systemlib.php"
|
||||
fi
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário