[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Mail/Exception/ -> MailDisabledException.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  namespace Joomla\CMS\Mail\Exception;
  11  
  12  // phpcs:disable PSR1.Files.SideEffects
  13  \defined('JPATH_PLATFORM') or die;
  14  // phpcs:enable PSR1.Files.SideEffects
  15  
  16  /**
  17   * Exception class defining an error for disabled mail functionality.
  18   *
  19   * @since  4.0.0
  20   */
  21  final class MailDisabledException extends \RuntimeException
  22  {
  23      /**
  24       * Send Mail option is disabled by the user.
  25       *
  26       * @var    string
  27       * @since  4.0.0
  28       */
  29      public const REASON_USER_DISABLED = 'user_disabled';
  30  
  31      /**
  32       * Mail() function is not available on the system.
  33       *
  34       * @var    string
  35       * @since  4.0.0
  36       */
  37      public const REASON_MAIL_FUNCTION_NOT_AVAILABLE = 'mail_function_not_available';
  38  
  39      /**
  40       * Reason mail is disabled.
  41       *
  42       * @var    string
  43       * @since  4.0.0
  44       */
  45      private $reason;
  46  
  47      /**
  48       * Constructor.
  49       *
  50       * @param   string      $reason    The reason why mail is disabled.
  51       * @param   string      $message   The Exception message to throw.
  52       * @param   integer     $code      The Exception code.
  53       * @param   \Throwable  $previous  The previous exception used for the exception chaining.
  54       *
  55       * @since   4.0.0
  56       */
  57      public function __construct(string $reason, string $message = '', int $code = 0, \Throwable $previous = null)
  58      {
  59          parent::__construct($message, $code, $previous);
  60  
  61          $this->reason = $reason;
  62      }
  63  
  64      /**
  65       * Method to return the reason why mail is disabled.
  66       *
  67       * @return  string
  68       *
  69       * @since   4.0.0
  70       */
  71      public function getReason(): string
  72      {
  73          return $this->reason;
  74      }
  75  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer