ResponseLocationInterface.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace GuzzleHttp\Command\Guzzle\ResponseLocation;
  3. use GuzzleHttp\Command\Guzzle\Parameter;
  4. use GuzzleHttp\Command\ResultInterface;
  5. use Psr\Http\Message\ResponseInterface;
  6. /**
  7. * Location visitor used to parse values out of a response into an associative
  8. * array
  9. */
  10. interface ResponseLocationInterface
  11. {
  12. /**
  13. * Called before visiting all parameters. This can be used for seeding the
  14. * result of a command with default data (e.g. populating with JSON data in
  15. * the response then adding to the parsed data).
  16. *
  17. * @param ResultInterface $result Result being created
  18. * @param ResponseInterface $response Response being visited
  19. * @param Parameter $model Response model
  20. *
  21. * @return ResultInterface Modified result
  22. */
  23. public function before(
  24. ResultInterface $result,
  25. ResponseInterface $response,
  26. Parameter $model
  27. );
  28. /**
  29. * Called after visiting all parameters
  30. *
  31. * @param ResultInterface $result Result being created
  32. * @param ResponseInterface $response Response being visited
  33. * @param Parameter $model Response model
  34. *
  35. * @return ResultInterface Modified result
  36. */
  37. public function after(
  38. ResultInterface $result,
  39. ResponseInterface $response,
  40. Parameter $model
  41. );
  42. /**
  43. * Called once for each parameter being visited that matches the location
  44. * type.
  45. *
  46. * @param ResultInterface $result Result being created
  47. * @param ResponseInterface $response Response being visited
  48. * @param Parameter $param Parameter being visited
  49. *
  50. * @return ResultInterface Modified result
  51. */
  52. public function visit(
  53. ResultInterface $result,
  54. ResponseInterface $response,
  55. Parameter $param
  56. );
  57. }