Completed
Push — 4.0 ( ad8a54...ed771a )
by Marco
06:33
created

Status405   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 14
ccs 0
cts 5
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A consolidate() 0 10 2
1
<?php namespace Comodojo\Dispatcher\Response\Preprocessor;
2
3
use \Exception;
4
5
/**
6
 * Status: Method Not Allowed
7
 *
8
 * @package     Comodojo Dispatcher
9
 * @author      Marco Giovinazzi <[email protected]>
10
 * @author      Marco Castiello <[email protected]>
11
 * @license     GPL-3.0+
12
 *
13
 * LICENSE:
14
 *
15
 * This program is free software: you can redistribute it and/or modify
16
 * it under the terms of the GNU Affero General Public License as
17
 * published by the Free Software Foundation, either version 3 of the
18
 * License, or (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU Affero General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU Affero General Public License
26
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27
 */
28
29
class Status405 extends Status400 {
30
31
    public function consolidate() {
32
33
        // An Allow Header should be provided from DispatcherException
34
        $allow = $this->response()->headers()->get('Allow');
35
36
        if ( is_null($allow) ) throw new Exception("Missing Allow header");
37
38
        parent::consolidate();
39
40
    }
41
42
}
43