Result.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Payment\Gateway\Validator;
  7. use Magento\Framework\Phrase;
  8. class Result implements ResultInterface
  9. {
  10. /**
  11. * @var bool
  12. */
  13. private $isValid;
  14. /**
  15. * @var Phrase[]
  16. */
  17. private $failsDescription;
  18. /**
  19. * @var string[]
  20. */
  21. private $errorCodes;
  22. /**
  23. * @param bool $isValid
  24. * @param array $failsDescription
  25. * @param array $errorCodes
  26. */
  27. public function __construct(
  28. $isValid,
  29. array $failsDescription = [],
  30. array $errorCodes = []
  31. ) {
  32. $this->isValid = (bool)$isValid;
  33. $this->failsDescription = $failsDescription;
  34. $this->errorCodes = $errorCodes;
  35. }
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public function isValid(): bool
  40. {
  41. return $this->isValid;
  42. }
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function getFailsDescription(): array
  47. {
  48. return $this->failsDescription;
  49. }
  50. /**
  51. * {@inheritdoc}
  52. */
  53. public function getErrorCodes(): array
  54. {
  55. return $this->errorCodes;
  56. }
  57. }