<?php

namespace QUI\MasterLogin;

use QUI;

/**
 * Class PermissionDeniedException
 *
 * Thrown if an unpermitted action is executed
 */
class PermissionDeniedException extends Exception
{
    protected $code = 401;

    /**
     * Constructor
     *
     * @param string|array $message - Text der Exception
     * @param integer $code - Error code der Exception
     * @param array $context - [optional] Context data, which data
     */
    public function __construct($message = null, int $code = 0, array $context = [])
    {
        if (empty($message)) {
            $message = QUI::getLocale()->get(
                'quiqqer/masterlogin',
                'exception.permission_denied'
            );
        }

        parent::__construct($message, $code, $context);
    }
}
