e6b6aa0b09
I noticed that directorty structure of hphp/system was a bit scattered, so I consolidated things to reduce the total number of folders and to put related things together with each other. This diff moves the contents of "hphp/system/classes_hhvm" into "hphp/system", it moves the contents of "hphp/system/lib" into "hphp/system", moves "hphp/idl" to "hphp/system/idl", and moves the contents of "hphp/system/globals" into "hphp/system/idl".
153 linhas
4.2 KiB
PHP
153 linhas
4.2 KiB
PHP
<?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() == '..';
|
|
}
|
|
}
|