1: <?php
2:
3: namespace Guzzle\Http\QueryAggregator;
4:
5: use Guzzle\Http\QueryString;
6:
7: /**
8: * Does not aggregate nested query string values and allows duplicates in the resulting array
9: *
10: * Example: http://test.com?q=1&q=2
11: */
12: class DuplicateAggregator implements QueryAggregatorInterface
13: {
14: /**
15: * {@inheritdoc}
16: */
17: public function aggregate($key, $value, QueryString $query)
18: {
19: if ($query->isUrlEncoding()) {
20: return array($query->encodeValue($key) => array_map(array($query, 'encodeValue'), $value));
21: } else {
22: return array($key => $value);
23: }
24: }
25: }
26: