CoreFiles by mySites.guru
MailDisabledException.php72 lines, 1,608 bytes, from Joomla_4.0.0-beta2-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta
md5
9d338bb1409070f3bbf3d68647c8966a
sha1
266ee182b43c2336836a41019506b8c0eccf88f4
sha256
00eb94434701e7260957428050101bfa390eca220327003c1de4e9790bea8dfc
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Mail\Exception;

\defined('JPATH_PLATFORM') or die;

/**
 * Exception class defining an error for disabled mail functionality.
 *
 * @since  4.0.0
 */
final class MailDisabledException extends \RuntimeException
{
	/**
	 * Send Mail option is disabled by the user.
	 *
	 * @var    string
	 * @since  4.0.0
	 */
	public const REASON_USER_DISABLED = 'user_disabled';

	/**
	 * Mail() function is not available on the system.
	 *
	 * @var    string
	 * @since  4.0.0
	 */
	public const REASON_MAIL_FUNCTION_NOT_AVAILABLE = 'mail_function_not_available';

	/**
	 * Reason mail is disabled.
	 *
	 * @var    string
	 * @since  4.0.0
	 */
	private $reason;

	/**
	 * Constructor.
	 *
	 * @param   string      $reason    The reason why mail is disabled.
	 * @param   string      $message   The Exception message to throw.
	 * @param   integer     $code      The Exception code.
	 * @param   \Throwable  $previous  The previous exception used for the exception chaining.
	 *
	 * @since   4.0.0
	 */
	public function __construct(string $reason, string $message = '', int $code = 0, \Throwable $previous = null)
	{
		parent::__construct($message, $code, $previous);

		$this->reason = $reason;
	}

	/**
	 * Method to return the reason why mail is disabled.
	 *
	 * @return  string
	 *
	 * @since   4.0.0
	 */
	public function getReason(): string
	{
		return $this->reason;
	}
}

The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.