SaitoForbiddenException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 7
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Saito - The Threaded Web Forum
7
 *
8
 * @copyright Copyright (c) the Saito Project Developers
9
 * @link https://github.com/Schlaefer/Saito
10
 * @license http://opensource.org/licenses/MIT
11
 */
12
13
namespace Saito\Exception;
14
15
use Cake\Http\Exception\HttpException;
16
use Saito\Exception\Logger\ForbiddenLogger;
17
18
class SaitoForbiddenException extends HttpException
19
{
20
21
    /**
22
     * {@inheritDoc}
23
     */
24
    public function __construct($message = null, $data = [])
25
    {
26
        $logger = new ForbiddenLogger();
27
        $logger->write($message, $data);
28
29
        $publicMessage = __('exc.forbidden');
30
        parent::__construct($publicMessage, 403);
31
    }
32
}
33