You are here

public function SessionHelper::checkPath in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 stream_wrapper_example/src/SessionHelper.php \Drupal\stream_wrapper_example\SessionHelper::checkPath()

Does path exist?

Parameters

string $path: Path into the store.

Return value

bool Existed or not.

1 call to SessionHelper::checkPath()
SessionHelper::clearPath in modules/stream_wrapper_example/src/SessionHelper.php
Clear a path into our store.

File

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

Class

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

Namespace

Drupal\stream_wrapper_example

Code

public function checkPath($path) {
  $path_info = $this
    ->getParentPath($path);
  $store_info = $this
    ->processPath($path_info['dirname']);
  if (empty($store_info)) {

    // Containing directory did not exist.
    return FALSE;
  }

  // Check if we are at the root of a directory.
  if ($path_info['basename'] === '') {
    return TRUE;
  }
  return isset($store_info['tip'][$path_info['basename']]);
}