Skip to content

Commit

Permalink
Update 404 error page to use view method
Browse files Browse the repository at this point in the history
  • Loading branch information
susanBuck committed Nov 7, 2022
1 parent b367d09 commit 31e14b8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function __construct($context = 'web')
$this->sessionSet($this->sessionRedirect, null);

# Load routes
$this->routes = include DOC_ROOT.'routes.php';
$this->routes = include DOC_ROOT . 'routes.php';

# Initialize Blade
$this->blade = new Blade(DOC_ROOT . '/views', DOC_ROOT . '/cache');
Expand Down Expand Up @@ -198,7 +198,7 @@ public function param($key, $default = null)
*/
public function path(string $path)
{
return DOC_ROOT.$path;
return DOC_ROOT . $path;
}

/**
Expand All @@ -222,7 +222,7 @@ public function route()
{
$fullUrl = '/' . substr($_SERVER['REQUEST_URI'], 1);
$parsedUrl = parse_url($fullUrl);
$path = $parsedUrl['path'];
$path = $parsedUrl['path'] ?? '';

if ($path != '/') {
$path = rtrim($path, '/');
Expand All @@ -241,7 +241,7 @@ public function route()
return $controller->$method();
# Route not found, return 404 error page
} else {
return $this->blade->view()->make('errors.404')->with(['app' => $this])->render();
return $this->view('errors.404', ['app' => $this]);
}
}

Expand Down Expand Up @@ -303,4 +303,4 @@ public function view(string $view, $data = [])
{
echo $this->blade->make($view)->with($data)->with(['app' => $this])->render();
}
}
}

0 comments on commit 31e14b8

Please sign in to comment.