Example #1
0
 /**
  * Aggregates nested query string variables using the same technique as
  * ``http_build_query()``.
  *
  * @param bool $numericIndices Pass false to not include numeric indices
  *     when multi-values query string parameters are present.
  *
  * @return callable
  */
 public static function phpAggregator($numericIndices = true)
 {
     return function (array $data) use($numericIndices) {
         return Query::walkQuery($data, '', function ($key, $prefix) use($numericIndices) {
             return !$numericIndices && is_int($key) ? "{$prefix}[]" : "{$prefix}[{$key}]";
         });
     };
 }