Conditions | 2 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | public function compact(): callable |
||
13 | { |
||
14 | /** |
||
15 | * Takes the first and last part of the string and glues them together with the seperator. |
||
16 | */ |
||
17 | return function ($value, int $eachSide = 32, string $seperator = ' ... '): string { |
||
18 | if (strlen($value) <= $eachSide * 2) { |
||
19 | return $value; |
||
20 | } |
||
21 | |||
22 | return implode($seperator, [ |
||
23 | substr($value, 0, $eachSide), |
||
24 | substr($value, $eachSide * -1), |
||
25 | ]); |
||
29 |