You are here

protected function AcquiaContentHubFiltersCommands::truncateString in Acquia Content Hub 8.2

Truncates string.

Parameters

string $value: String to truncate.

string $marker: Truncation marker.

Return value

string Truncated string.

1 call to AcquiaContentHubFiltersCommands::truncateString()
AcquiaContentHubFiltersCommands::buildRows in src/Commands/AcquiaContentHubFiltersCommands.php
Returns rows of result table.

File

src/Commands/AcquiaContentHubFiltersCommands.php, line 383

Class

AcquiaContentHubFiltersCommands
Drush command to interact with Acquia Content Hub filters.

Namespace

Drupal\acquia_contenthub\Commands

Code

protected function truncateString(string $value, string $marker = '...') : string {
  $markerLength = mb_strlen($marker);
  return mb_strlen($value) <= self::STRING_VALUE_MAX_LENGTH ? $value : mb_substr($value, 0, self::STRING_VALUE_MAX_LENGTH - $markerLength) . $marker;
}