You are here

class TrailingSlashHelper in Trailing Slash 8

Class TrailingSlashHelper

@package Drupal\trailing_slash\Helper\Url

Hierarchy

Expanded class hierarchy of TrailingSlashHelper

2 files declare their use of TrailingSlashHelper
TrailingSlashOutboundPathProcessor.php in src/PathProcessor/TrailingSlashOutboundPathProcessor.php
TrailingSlashUrlGenerator.php in src/Routing/TrailingSlashUrlGenerator.php

File

src/Helper/Url/TrailingSlashHelper.php, line 10

Namespace

Drupal\trailing_slash\Helper\Url
View source
class TrailingSlashHelper {

  /**
   * Add a slash at the end if you do not have one.
   *
   * @param $path
   */
  public static function add(&$path) {
    $path = preg_replace('/((?:^|\\/)[^\\/\\.]+?)$/isD', '$1/', $path);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TrailingSlashHelper::add public static function Add a slash at the end if you do not have one.