Success.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\AdminNotification\Model\System\Message\Media\Synchronization;
  7. /**
  8. * Media synchronization success message class.
  9. *
  10. * @api
  11. * @since 100.0.2
  12. */
  13. class Success extends \Magento\AdminNotification\Model\System\Message\Media\AbstractSynchronization
  14. {
  15. /**
  16. * Message identity
  17. *
  18. * @var string
  19. */
  20. protected $_identity = 'MEDIA_SYNCHRONIZATION_SUCCESS';
  21. /**
  22. * Check whether
  23. *
  24. * @return bool
  25. */
  26. protected function _shouldBeDisplayed()
  27. {
  28. $state = $this->_syncFlag->getState();
  29. $data = $this->_syncFlag->getFlagData();
  30. $hasErrors = !empty($data['has_errors']);
  31. return !$hasErrors && \Magento\MediaStorage\Model\File\Storage\Flag::STATE_FINISHED == $state;
  32. }
  33. /**
  34. * Retrieve message text
  35. *
  36. * @return \Magento\Framework\Phrase
  37. */
  38. public function getText()
  39. {
  40. return __('Synchronization of media storages has been completed.');
  41. }
  42. }