1<?php
2namespace Aws\Api\Parser;
3
4use Aws\Api\Service;
5use Aws\Api\StructureShape;
6use Aws\CommandInterface;
7use Aws\ResultInterface;
8use Psr\Http\Message\ResponseInterface;
9use Psr\Http\Message\StreamInterface;
10
11/**
12 * @internal
13 */
14abstract class AbstractParser
15{
16    /** @var \Aws\Api\Service Representation of the service API*/
17    protected $api;
18
19    /** @var callable */
20    protected $parser;
21
22    /**
23     * @param Service $api Service description.
24     */
25    public function __construct(Service $api)
26    {
27        $this->api = $api;
28    }
29
30    /**
31     * @param CommandInterface  $command  Command that was executed.
32     * @param ResponseInterface $response Response that was received.
33     *
34     * @return ResultInterface
35     */
36    abstract public function __invoke(
37        CommandInterface $command,
38        ResponseInterface $response
39    );
40
41    abstract public function parseMemberFromStream(
42        StreamInterface $stream,
43        StructureShape $member,
44        $response
45    );
46}
47