MethodNotAllowedException   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 MethodNotAllowedException
18
 * Used to configure an exception for a service error.
19
 *
20
 * @package CakeDC\Api\Exception
21
 */
22
class MethodNotAllowedException extends Exception
23
{
24
25
    /**
26
     * MethodNotAllowedException constructor.
27
     *
28
     * @param string $message the string of the error message
29
     * @param int $code The code of the error
30
     * @param \Exception|null $previous the previous exception.
31
     */
32
    public function __construct($message = null, $code = 405, $previous = null)
33
    {
34
        if (empty($message)) {
35
            $message = 'Method not allowed';
36
        }
37
        parent::__construct($message, $code, $previous);
38
    }
39
40
    /**
41
     * File setter
42
     *
43
     * @param string $file file name
44
     * @return void
45
     */
46
    public function setFile($file = '')
47
    {
48
        $this->file = $file;
49
    }
50
51
    /**
52
     * Line setter
53
     *
54
     * @param int $line set the line of the code
55
     * @return void
56
     */
57
    public function setLine($line = 0)
58
    {
59
        $this->line = $line;
60
    }
61
}
62