ForbiddenLogger   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 23
rs 10
c 1
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A write() 0 7 2
A _write() 0 6 1
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\Logger;
14
15
use Cake\Log\Log;
16
17
class ForbiddenLogger extends ExceptionLogger
18
{
19
    /**
20
     * {@inheritDoc}
21
     */
22
    public function write($message = null, $data = null)
23
    {
24
        if (empty($message)) {
25
            $message = 'Forbidden';
26
        }
27
28
        parent::write($message, $data);
29
    }
30
31
    /**
32
     * {@inheritDoc}
33
     */
34
    protected function _write()
35
    {
36
        Log::write(
37
            'error',
38
            $this->_message(),
39
            ['scope' => ['saito.forbidden']]
40
        );
41
    }
42
}
43