| 1 | <?php |
||
| 3 | class HelperArray { |
||
| 4 | |||
| 5 | /** |
||
| 6 | * Convert $delimiter delimited string to array |
||
| 7 | * |
||
| 8 | * @param mixed $string |
||
| 9 | * @param string $delimiter |
||
| 10 | * |
||
| 11 | * @return array |
||
| 12 | */ |
||
| 13 | public static function stringToArray($string, $delimiter = ',') { |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Convert single value to array |
||
| 19 | * |
||
| 20 | * @param mixed $value |
||
| 21 | * |
||
| 22 | * @return array |
||
| 23 | */ |
||
| 24 | public static function makeArray(&$value, $index = 0) { |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param mixed $array |
||
| 30 | * @param callable $callback |
||
| 31 | * |
||
| 32 | * @return array |
||
| 33 | */ |
||
| 34 | public static function filter(&$array, $callback) { |
||
| 48 | |||
| 49 | protected static function isNotEmpty($value) { |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Filter empty() values from array |
||
| 55 | * |
||
| 56 | * @param $array |
||
| 57 | * |
||
| 58 | * @return array |
||
| 59 | */ |
||
| 60 | public static function filterEmpty($array) { |
||
| 63 | |||
| 64 | public static function stringToArrayFilterEmpty($string, $delimiter = ',') { |
||
| 67 | |||
| 68 | } |
||
| 69 |