| 1 | <?php |
||
| 5 | class Util |
||
| 6 | { |
||
| 7 | const ESCAPE_CHARACTER_REGEX = '\\033\[\d+m'; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * Find longest string length among keys |
||
| 11 | * |
||
| 12 | * Only visible characters are considered |
||
| 13 | * |
||
| 14 | * @param array $array |
||
| 15 | * |
||
| 16 | * @return int |
||
| 17 | */ |
||
| 18 | public static function getMaxKeyLength(array $array) |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Find longest string length among values |
||
| 34 | * |
||
| 35 | * Only visible characters are considered |
||
| 36 | * |
||
| 37 | * @param array $array |
||
| 38 | * |
||
| 39 | * @return int |
||
| 40 | */ |
||
| 41 | public static function getMaxValueLength(array $array) |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Build a string composed of $pattern repeated $length times |
||
| 57 | * |
||
| 58 | * @param string $pattern |
||
| 59 | * @param int $length |
||
| 60 | * |
||
| 61 | * @return string |
||
| 62 | */ |
||
| 63 | public static function buildPatternLine($pattern, $length) |
||
| 72 | |||
| 73 | /** |
||
| 74 | * Compute string length of only visible characters |
||
| 75 | * |
||
| 76 | * @param $string |
||
| 77 | * |
||
| 78 | * @return int |
||
| 79 | */ |
||
| 80 | public static function getVisibleStringLength($string) |
||
| 88 | } |
||
| 89 |