public function SessionStreamWrapper::dir_opendir in Examples for Developers 8
Same name and namespace in other branches
- 3.x modules/stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php \Drupal\stream_wrapper_example\StreamWrapper\SessionStreamWrapper::dir_opendir()
Return value
bool
Overrides PhpStreamWrapperInterface::dir_opendir
File
- stream_wrapper_example/
src/ StreamWrapper/ SessionStreamWrapper.php, line 805
Class
- SessionStreamWrapper
- Example stream wrapper class to handle session:// streams.
Namespace
Drupal\stream_wrapper_example\StreamWrapperCode
public function dir_opendir($uri, $options) {
// @codingStandardsIgnoreEnd
$path = $this
->getLocalPath($uri);
if (!$this->sessionHelper
->checkPath($path)) {
return FALSE;
}
$var = $this->sessionHelper
->getPath($path);
if (!is_array($var)) {
return FALSE;
}
// We grab the list of key names, flip it so that .isadir.txt can easily
// be removed, then flip it back so we can easily walk it as a list.
$this->directoryKeys = array_flip(array_keys($var));
unset($this->directoryKeys['.isadir.txt']);
$this->directoryKeys = array_keys($this->directoryKeys);
$this->directoryPointer = 0;
return TRUE;
}