You are here

trait PathTrait in Tome 8

Contains methods useful for working with paths.

@internal

Hierarchy

8 files declare their use of PathTrait
CleanFilesCommand.php in modules/tome_sync/src/Commands/CleanFilesCommand.php
Exporter.php in modules/tome_sync/src/Exporter.php
FileSync.php in modules/tome_sync/src/FileSync.php
LanguagePathSubscriber.php in modules/tome_static/src/EventSubscriber/LanguagePathSubscriber.php
PathTraitTest.php in modules/tome_base/tests/src/Unit/PathTraitTest.php

... See full list

File

modules/tome_base/src/PathTrait.php, line 10

Namespace

Drupal\tome_base
View source
trait PathTrait {

  /**
   * Joins multiple paths.
   *
   * Original credit to Riccardo Galli.
   *
   * @see https://stackoverflow.com/a/15575293
   *
   * @return string
   *   The joined path.
   */
  protected function joinPaths() {
    $paths = [];
    foreach (func_get_args() as $arg) {
      if ($arg !== '') {
        $paths[] = $arg;
      }
    }
    return rtrim(preg_replace('#(?<!:)/+#', '/', implode('/', $paths)), '/');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PathTrait::joinPaths protected function Joins multiple paths.