You are here

private static function Redirects::cleanUrlEnds in Hook Update Deploy Tools 8

Same name and namespace in other branches
  1. 7 src/Redirects.php \HookUpdateDeployTools\Redirects::cleanUrlEnds()

Remove spaces and slashes.

Parameters

string $string: The string to be trimmed. (by reference)

1 call to Redirects::cleanUrlEnds()
Redirects::parseList in src/Redirects.php
Create redirects from a list of redirects.

File

src/Redirects.php, line 330

Class

Redirects
Public methods for importing redirects.

Namespace

HookUpdateDeployTools

Code

private static function cleanUrlEnds(&$string) {

  // Trim initial /.
  $chars_to_trim = '/ ';
  $string = ltrim($string, $chars_to_trim);

  // Trim trailing slashes.
  $string = rtrim($string, $chars_to_trim);

  // Trim any new extra spaces from the end of the urls.
  $string = rtrim($string);
}