Passed
Branch master (487060)
by Wanderson
03:41 queued 01:00
created

ErrorsController::_503()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 7
rs 10
1
<?php
2
3
namespace App\Controllers;
4
5
use Throwable;
6
use Win\Controllers\Controller;
7
use Win\Templates\View;
8
9
/**
10
 * Páginas de Erros 
11
 * 404, 500, etc
12
 */
13
class ErrorsController extends Controller
14
{
15
	/** @var Throwable */
16
	public $error;
17
18
	public function _404(Throwable $e)
19
	{
20
		http_response_code(404);
21
		$this->title = 'Página não encontrada';
22
		$this->error = $e;
23
24
		return new View('errors/404');
25
	}
26
27
	public function _500(Throwable $e)
28
	{
29
		http_response_code(500);
30
		$this->layout = null;
31
		$this->title = 'Ocorreu um erro';
32
		$this->error = $e;
33
34
		return new View('errors/500');
35
	}
36
}
37