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. 8.x-1.x stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php \Drupal\stream_wrapper_example\StreamWrapper\SessionStreamWrapper::dir_opendir()

Overrides PhpStreamWrapperInterface::dir_opendir

File

modules/stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php, line 803

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 to easily remove .is_a_dir.txt,
    // and flip it back.
    $this->directoryKeys = array_flip(array_keys($var));
    unset($this->directoryKeys['.is_a_dir.txt']);
    $this->directoryKeys = array_keys($this->directoryKeys);
    $this->directoryPointer = 0;
    return TRUE;
}