AlreadyExistsException.php 641 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Exception;
  7. use Magento\Framework\Phrase;
  8. /**
  9. * @api
  10. * @since 100.0.2
  11. */
  12. class AlreadyExistsException extends LocalizedException
  13. {
  14. /**
  15. * @param Phrase $phrase
  16. * @param \Exception $cause
  17. * @param int $code
  18. */
  19. public function __construct(Phrase $phrase = null, \Exception $cause = null, $code = 0)
  20. {
  21. if ($phrase === null) {
  22. $phrase = new Phrase('Unique constraint violation found');
  23. }
  24. parent::__construct($phrase, $cause, $code);
  25. }
  26. }