function SessionHelper::getPath

Same name in other branches
  1. 4.0.x modules/stream_wrapper_example/src/SessionHelper.php \Drupal\stream_wrapper_example\SessionHelper::getPath()

Get a path.

Parameters

string $path: A URI with the SCHEME:// part removed.

Return value

mixed Return the stored value at this "node" of the store.

File

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

Class

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

Namespace

Drupal\stream_wrapper_example

Code

public function getPath($path) {
    $path_info = $this->getParentPath($path);
    $store_info = $this->processPath($path_info['dirname']);
    $leaf = $path_info['basename'];
    if ($store_info === FALSE) {
        return NULL;
    }
    if ($store_info['store'] === $store_info['tip']) {
        // We are at the top of the hierarchy; return the store itself.
        if (empty($path_info['basename'])) {
            return $store_info['store'];
        }
        if (!isset($store_info['store'][$leaf])) {
            return NULL;
        }
    }
    return $store_info['tip'][$leaf];
}