/**
* Read raw lines of data from a directory pointer and return the data
*
- * @return $current Current entry from encapsulated iterator
+ * @return $currentEntry Current entry from encapsulated iterator
*/
public function readRawDirectory () {
// Can the next entry be read?
assert($this->getDirectoryInstance()->valid());
// Default is FALSE
- $current = FALSE;
+ $currentEntry = FALSE;
// Is it a dot directory?
if (!$this->getDirectoryInstance()->isDot()) {
// Read data from the directory pointer and return it
- $current = $this->getDirectoryInstance()->current();
+ $currentEntry = $this->getDirectoryInstance()->current();
} // END - if
// Advance to next entry
$this->getDirectoryInstance()->next();
// Return found entry
- return $current;
+ return $currentEntry;
}
/**
return $this->readRawDirectory();
} // END - if
+ // Init raw line
+ $rawLine = NULL;
+
// Read a raw line...
- $rawLine = $this->readRawDirectory();
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: rawLine[' . gettype($rawLine) . ']=' . $rawLine);
+ $currentEntry = $this->readRawDirectory();
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: currentEntry[]=' . gettype($currentEntry));
// Shall we exclude directories?
- if ((!is_null($rawLine)) && ($rawLine !== FALSE) && (!in_array($rawLine, $except))) {
- // Return read data
+ if (is_object($currentEntry)) {
+ // Get file name
+ $rawLine = $currentEntry->getFilename();
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: rawLine[' . gettype($rawLine) . ']=' . $rawLine);
- return $rawLine;
- } elseif ((!is_null($rawLine)) && ($rawLine !== FALSE)) {
- // Exclude this part
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: rawline[' . gettype($rawLine) . ']=' . $rawLine . ' - Recursive call!');
- return $this->readDirectoryExcept($except);
- }
- // End pointer reached
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: Returning NULL!');
- return NULL;
+ // Is it not excluded?
+ if (in_array($rawLine, $except)) {
+ // Exclude this part
+ $rawLine = $this->readDirectoryExcept($except);
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: rawline[' . gettype($rawLine) . ']=' . $rawLine . ' - Recursive call!');
+ } // END - if
+ } // END - if
+
+ // Return read line
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: rawLine[' . gettype($rawLine) . ']=' . $rawLine);
+ return $rawLine;
}
/**