CollectionDirection.php 729 B

123456789101112131415161718192021222324252627
  1. <?php
  2. declare(strict_types=1);
  3. namespace Yansongda\Pay\Direction;
  4. use Psr\Http\Message\ResponseInterface;
  5. use Yansongda\Pay\Contract\DirectionInterface;
  6. use Yansongda\Pay\Contract\PackerInterface;
  7. use Yansongda\Pay\Exception\ContainerException;
  8. use Yansongda\Pay\Exception\ServiceNotFoundException;
  9. use Yansongda\Pay\Pay;
  10. use Yansongda\Supports\Collection;
  11. class CollectionDirection implements DirectionInterface
  12. {
  13. /**
  14. * @throws ContainerException
  15. * @throws ServiceNotFoundException
  16. */
  17. public function parse(PackerInterface $packer, ?ResponseInterface $response): Collection
  18. {
  19. return new Collection(
  20. Pay::get(ArrayDirection::class)->parse($packer, $response)
  21. );
  22. }
  23. }