AuthenticationExceptionFailure.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * MageSpecialist
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Open Software License (OSL 3.0)
  8. * that is bundled with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://opensource.org/licenses/osl-3.0.php
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to info@magespecialist.it so we can send you a copy immediately.
  14. *
  15. * @category MSP
  16. * @package MSP_ReCaptcha
  17. * @copyright Copyright (c) 2017 Skeeller srl (http://www.magespecialist.it)
  18. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  19. */
  20. namespace MSP\ReCaptcha\Model\Provider\Failure;
  21. use Magento\Framework\App\ResponseInterface;
  22. use Magento\Framework\Exception\Plugin\AuthenticationException;
  23. use MSP\ReCaptcha\Model\Config;
  24. use MSP\ReCaptcha\Model\Provider\FailureProviderInterface;
  25. class AuthenticationExceptionFailure implements FailureProviderInterface
  26. {
  27. /**
  28. * @var Config
  29. */
  30. private $config;
  31. /**
  32. * AuthenticationExceptionFailure constructor.
  33. * @param Config $config
  34. */
  35. public function __construct(
  36. Config $config
  37. ) {
  38. $this->config = $config;
  39. }
  40. /**
  41. * Handle reCaptcha failure
  42. * @param ResponseInterface $response
  43. * @return void
  44. * @throws AuthenticationException
  45. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  46. */
  47. public function execute(ResponseInterface $response = null)
  48. {
  49. throw new AuthenticationException($this->config->getErrorDescription());
  50. }
  51. }