| 1 | <?php |
||
| 5 | class ArrayUtil |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Explodes the given $string by $delimiter, trims all values and only adds non empty values to the result array. |
||
| 9 | * |
||
| 10 | * @param string $delimiter |
||
| 11 | * @param string $string |
||
| 12 | * |
||
| 13 | * @return array |
||
| 14 | */ |
||
| 15 | public static function explodeTrim($delimiter, $string) |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Implodes an array of strings in a human language matter. |
||
| 32 | * |
||
| 33 | * With default values: ['Foo', 'bar', 'baz'] => 'Foo, bar and baz' |
||
| 34 | * |
||
| 35 | * @param array $pieces |
||
| 36 | * @param string $conjunction |
||
| 37 | * @param string $glue |
||
| 38 | * |
||
| 39 | * @return mixed|string |
||
| 40 | */ |
||
| 41 | public static function humanImplode(array $pieces, $conjunction = 'and', $glue = ',') |
||
| 56 | } |
||
| 57 |