StripWhitespaceTrait.php in Fences 8.2
Namespace
Drupal\Tests\fences\TraitsFile
tests/src/Traits/StripWhitespaceTrait.phpView source
<?php
namespace Drupal\Tests\fences\Traits;
/**
* A trait to strip whitespace.
*/
trait StripWhitespaceTrait {
/**
* Remove HTML whitespace from a string.
*
* @param string $string
* The input string.
*
* @return string
* The whitespace cleaned string.
*/
protected function stripWhitespace($string) {
$no_whitespace = preg_replace('/\\s{2,}/', '', $string);
$no_whitespace = str_replace("\n", '', $no_whitespace);
return $no_whitespace;
}
}
Traits
Name | Description |
---|---|
StripWhitespaceTrait | A trait to strip whitespace. |