AbstractParser.php 1006 B

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