You are here

public function SessionHelper::getParentPath in Examples for Developers 8

Same name and namespace in other branches
  1. 3.x modules/stream_wrapper_example/src/SessionHelper.php \Drupal\stream_wrapper_example\SessionHelper::getParentPath()

The equivalent to dirname() and basename() for a path.

Parameters

string $path: A file-system like path string.

Return value

array Associative array defining an interal path of our data store. .

4 calls to SessionHelper::getParentPath()
SessionHelper::checkPath in stream_wrapper_example/src/SessionHelper.php
Does path exist?
SessionHelper::clearPath in stream_wrapper_example/src/SessionHelper.php
Clear a path into our store.
SessionHelper::getPath in stream_wrapper_example/src/SessionHelper.php
Get a path.
SessionHelper::setPath in stream_wrapper_example/src/SessionHelper.php
Set a path.

File

stream_wrapper_example/src/SessionHelper.php, line 132

Class

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

Namespace

Drupal\stream_wrapper_example

Code

public function getParentPath($path) {
  $dirs = explode('/', $path);
  $tip = array_pop($dirs);
  $parent = implode('/', $dirs);
  return [
    'dirname' => $parent,
    'basename' => $tip,
  ];
}