function SessionStreamWrapper::dir_opendir

Same name in other branches
  1. 3.x modules/stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php \Drupal\stream_wrapper_example\StreamWrapper\SessionStreamWrapper::dir_opendir()
  2. 4.0.x modules/stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php \Drupal\stream_wrapper_example\StreamWrapper\SessionStreamWrapper::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\StreamWrapper

Code

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;
}