CoreFiles by mySites.guru
MailDisabledException.php75 lines, 1,825 bytes, from Joomla_4.2.2-Stable-Full_Package.zip
Raw History Compare with 4.2.1
md5
42b57f94e5c0a4e171f1f0733e9a2445
sha1
5d3ad7ed73098360f196450247c63079cb33de59
sha256
0feec5bb19ea6125d94b4d99c72db19da46d1a6f0c957d5a263593c75fc4984e
<?php

/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2020 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Mail\Exception;

// phpcs:disable PSR1.Files.SideEffects
\defined('JPATH_PLATFORM') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * 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 70 releases, Joomla 4.2.1 to 4.4.14. See them all, or every version of this file.