function SessionHelper::clearPath

Clear a path into our store.

Parameters

string $path: The path portion of a URI (i.e., without the SCHEME://).

File

modules/stream_wrapper_example/src/SessionHelper.php, line 145

Class

SessionHelper
Helper to manage file wrapper data stored in the session object.

Namespace

Drupal\stream_wrapper_example

Code

public function clearPath($path) {
  $this->getStore();
  if ($this->checkPath($path)) {
    $path_info = $this->getParentPath($path);
    $store_info = $this->processPath($path_info['dirname']);
    if ($store_info === FALSE) {
      // The path was not found, nothing to do.
      return;
    }
    // We want to clear the key at the tip, so...
    unset($store_info['tip'][$path_info['basename']]);
    // Write back to the store.
    $this->setStore($store_info['store']);
  }
}