You are here

TrailingSlashHelper.php in Trailing Slash 8

File

src/Helper/Url/TrailingSlashHelper.php
View source
<?php

namespace Drupal\trailing_slash\Helper\Url;


/**
 * Class TrailingSlashHelper
 *
 * @package Drupal\trailing_slash\Helper\Url
 */
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);
  }

}

Classes

Namesort descending Description
TrailingSlashHelper Class TrailingSlashHelper