UnauthorizedException   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 40
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A setFile() 0 4 1
A setLine() 0 4 1
1
<?php
2
/**
3
 * Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
4
 *
5
 * Licensed under The MIT License
6
 * Redistributions of files must retain the above copyright notice.
7
 *
8
 * @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
9
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
10
 */
11
12
namespace CakeDC\Api\Exception;
13
14
use Cake\Core\Exception\Exception;
15
16
/**
17
 * Class UnauthorizedException
18
 *
19
 * @package CakeDC\Api\Exception
20
 */
21
class UnauthorizedException extends Exception
22
{
23
24
    /**
25
     * UnauthorizedException constructor.
26
     *
27
     * @param string $message the string of the error message
28
     * @param int $code The code of the error
29
     * @param \Exception|null $previous the previous exception.
30
     */
31
    public function __construct($message = null, $code = 403, $previous = null)
32
    {
33
        if (empty($message)) {
34
            $message = 'Unauthorized';
35
        }
36
        parent::__construct($message, $code, $previous);
37
    }
38
39
    /**
40
     * File setter
41
     *
42
     * @param string $file file name
43
     * @return void
44
     */
45
    public function setFile($file = '')
46
    {
47
        $this->file = $file;
48
    }
49
50
    /**
51
     * Line setter
52
     *
53
     * @param int $line line of the code
54
     * @return void
55
     */
56
    public function setLine($line = 0)
57
    {
58
        $this->line = $line;
59
    }
60
}
61