1: <?php
2:
3: namespace Guzzle\Service\Command\LocationVisitor\Response;
4:
5: use Guzzle\Http\Message\Response;
6: use Guzzle\Service\Description\Parameter;
7: use Guzzle\Service\Command\CommandInterface;
8:
9: 10: 11:
12: class extends AbstractResponseVisitor
13: {
14: 15: 16:
17: public function visit(CommandInterface $command, Response $response, Parameter $param, &$value, $context = null)
18: {
19: if ($param->getType() == 'object' && $param->getAdditionalProperties() instanceof Parameter) {
20: $this->processPrefixedHeaders($response, $param, $value);
21: } else {
22: $value[$param->getName()] = $param->filter((string) $response->getHeader($param->getWireName()));
23: }
24: }
25:
26: 27: 28: 29: 30: 31: 32:
33: protected function (Response $response, Parameter $param, &$value)
34: {
35:
36: if ($prefix = $param->getSentAs()) {
37: $container = $param->getName();
38: $len = strlen($prefix);
39:
40: foreach ($response->getHeaders() as $key => $header) {
41: if (stripos($key, $prefix) === 0) {
42:
43: $value[$container][substr($key, $len)] = count($header) == 1 ? end($header) : $header;
44: }
45: }
46: }
47: }
48: }
49: