ClientVersionBuilder.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Signifyd\Model\SignifydGateway\Request;
  7. use Magento\Framework\App\ProductMetadataInterface;
  8. /**
  9. * Provides platform name, edition and version info
  10. */
  11. class ClientVersionBuilder
  12. {
  13. /**
  14. * @var string
  15. */
  16. private static $clientVersion = '1.0';
  17. /**
  18. * @var ProductMetadataInterface
  19. */
  20. private $productMetadata;
  21. /**
  22. * @param ProductMetadataInterface $productMetadata
  23. */
  24. public function __construct(
  25. ProductMetadataInterface $productMetadata
  26. ) {
  27. $this->productMetadata = $productMetadata;
  28. }
  29. /**
  30. * Returns version info
  31. *
  32. * @return array
  33. */
  34. public function build()
  35. {
  36. return [
  37. 'platformAndClient' => [
  38. 'storePlatform' => $this->productMetadata->getName() . ' ' . $this->productMetadata->getEdition(),
  39. 'storePlatformVersion' => $this->productMetadata->getVersion(),
  40. 'signifydClientApp' => $this->productMetadata->getName(),
  41. 'signifydClientAppVersion' => self::$clientVersion,
  42. ]
  43. ];
  44. }
  45. }