Вход Регистрация
Файл: vendor/laravel/prompts/src/Concerns/Truncation.php
Строк: 28
<?php

namespace LaravelPromptsConcerns;

use 
InvalidArgumentException;

trait 
Truncation
{
    
/**
     * Truncate a value with an ellipsis if it exceeds the given width.
     */
    
protected function truncate(string $stringint $width): string
    
{
        if (
$width <= 0) {
            throw new 
InvalidArgumentException("Width [{$width}] must be greater than zero.");
        }

        return 
mb_strwidth($string) <= $width $string : (mb_strimwidth($string0$width 1).'…');
    }
}
Онлайн: 1
Реклама