1<?php
2
3namespace Guzzle\Service\Command\LocationVisitor\Response;
4
5use Guzzle\Http\Message\Response;
6use Guzzle\Service\Description\Parameter;
7use Guzzle\Service\Command\CommandInterface;
8
9/**
10 * Location visitor used to parse values out of a response into an associative array
11 */
12interface ResponseVisitorInterface
13{
14    /**
15     * Called before visiting all parameters. This can be used for seeding the result of a command with default
16     * data (e.g. populating with JSON data in the response then adding to the parsed data).
17     *
18     * @param CommandInterface $command Command being visited
19     * @param array            $result  Result value to update if needed (e.g. parsing XML or JSON)
20     */
21    public function before(CommandInterface $command, array &$result);
22
23    /**
24     * Called after visiting all parameters
25     *
26     * @param CommandInterface $command Command being visited
27     */
28    public function after(CommandInterface $command);
29
30    /**
31     * Called once for each parameter being visited that matches the location type
32     *
33     * @param CommandInterface $command  Command being visited
34     * @param Response         $response Response being visited
35     * @param Parameter        $param    Parameter being visited
36     * @param mixed            $value    Result associative array value being updated by reference
37     * @param mixed            $context  Parsing context
38     */
39    public function visit(
40        CommandInterface $command,
41        Response $response,
42        Parameter $param,
43        &$value,
44        $context =  null
45    );
46}
47