Code Duplication    Length = 22-22 lines in 2 locations

src/Comodojo/Dispatcher/Output/HttpStatus/Status405.php 1 location

@@ 27-48 (lines=22) @@
24
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25
 */
26
27
class Status405 extends AbstractHttpStatus {
28
29
    public function consolidate() {
30
31
        // An Allow Header should be prvided from DispatcherException
32
        $allowed = $this->response()->headers()->get('Allow');
33
34
        if ( is_null($allowed) ) {
35
36
            header('Method not allowed', true, 405);
37
38
        } else {
39
40
            header("Allow: $allowed", true, 405);
41
42
            $this->response()->headers()->remove('Allow');
43
44
        }
45
46
    }
47
48
}
49

src/Comodojo/Dispatcher/Output/HttpStatus/Status501.php 1 location

@@ 27-48 (lines=22) @@
24
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25
 */
26
27
class Status501 extends AbstractHttpStatus {
28
29
    public function consolidate() {
30
31
        // An Allow Header should be prvided from DispatcherException
32
        $allowed = $this->response()->headers()->get('Allow');
33
34
        if ( is_null($allowed) ) {
35
36
            header('Method not implemented', true, 501);
37
38
        } else {
39
40
            header("Allow: $allowed", true, 501);
41
42
            $this->response()->headers()->remove('Allow');
43
44
        }
45
46
    }
47
48
}
49