UrlAlreadyExistsException.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\UrlRewrite\Model\Exception;
  7. use Magento\Framework\Phrase;
  8. /**
  9. * Exception for already created url.
  10. *
  11. * @api
  12. * @since 101.0.0
  13. */
  14. class UrlAlreadyExistsException extends \Magento\Framework\Exception\AlreadyExistsException
  15. {
  16. /**
  17. * @var array
  18. */
  19. private $urls = [];
  20. /**
  21. * @param \Magento\Framework\Phrase $phrase
  22. * @param \Exception $cause
  23. * @param int $code
  24. * @param array $urls
  25. */
  26. public function __construct(Phrase $phrase = null, \Exception $cause = null, $code = 0, array $urls = [])
  27. {
  28. $this->urls = $urls;
  29. if ($phrase === null) {
  30. $phrase = __('URL key for specified store already exists');
  31. }
  32. parent::__construct($phrase, $cause, $code);
  33. }
  34. /**
  35. * Get URLs
  36. *
  37. * @return array
  38. * @since 101.0.0
  39. */
  40. public function getUrls()
  41. {
  42. return $this->urls;
  43. }
  44. }